-
Notifications
You must be signed in to change notification settings - Fork 24.3k
torch.(min|max)(..., dim=...)
diverges from array API specification
#58745
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
These fixes break backward compatibility, so further discussion is needed. |
I was confused by what the issue was from reading the description. This is pretty odd: >>> import torch
>>> t = torch.tensor([1, 2, 3])
>>> t.min()
tensor(1)
>>> torch.min(t)
tensor(1)
>>> t_min = torch.min(t, axis=0)
>>> t_min
torch.return_types.min(
values=tensor(1),
indices=tensor(0)) Would be nice to get some context first - why does this work this way right now? |
torch.(min|max)
diverges from array API specificationtorch.(min|max)(..., axis=...)
diverges from array API specification
Probably for no good reason. @gchanan do you recall? |
torch.(min|max)(..., axis=...)
diverges from array API specificationtorch.(min|max)(..., dim=...)
diverges from array API specification
The Array
@rgommers While NumPy and the Array API standard have two functions |
We have amax and argmax, which is NumPy compatible and does the same thing. |
Also, an explicit >>> torch.max(t, dim=None)
Traceback (most recent call last):
...
RuntimeError: Please look up dimensions by name, got: name = None. |
|
Uh oh!
There was an error while loading. Please reload this page.
The array API specification stipulates that
torch.(max|min)
must always return a tensor. If called withdim=...
torch.return_types.(max|min)
is returned instead.cc @mruberry @rgommers @pmeier @asmeurer @leofang @heitorschueroff @asi1024
The text was updated successfully, but these errors were encountered: