ENH: use torch.clamp for wrapped_torch.clip#353
Conversation
Otherwise, the version which emulates "clip" fails with torch.vmap (see data-apisgh-350)
|
cc/fyi @mdhaber : IIRC scipy.stats is a big user of the |
|
Yes, but I don't recall putting Almost every |
|
We briefly discussed this in the Consortium meeting today (Dec 11, 2025). The general feeling was that |
Closes gh-350
Otherwise, the version which emulates "clip" fails with torch.vmap.
This patch is less innocuous than it looks, because it changes the promotion rules. Previously,
minandmaxwere not upcasting the result:and now they are:
OTOH, the wording in the spec, https://data-apis.org/array-api/draft/API_specification/generated/array_api.clip.html is
and