We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
torch.linalg.trace should work on stacks of matrices.
torch.linalg.trace
But this
import array_api_compat.torch as torch a = torch.reshape(torch.arange(10*5*5), (10,5,5)) torch.linalg.trace(a)
throws RuntimeError: trace: expected a matrix, but got tensor with dim 3.
RuntimeError: trace: expected a matrix, but got tensor with dim 3
The pytorch's trace function doesn't handle stacks: see the docs.
trace
The text was updated successfully, but these errors were encountered:
Thanks for the report. What's a good way to work around this? @lezcano
Sorry, something went wrong.
x.diagonal(0, -2, -1).sum(-1)
This was fixed in #80
No branches or pull requests
torch.linalg.trace
should work on stacks of matrices.But this
throws
RuntimeError: trace: expected a matrix, but got tensor with dim 3
.The pytorch's
trace
function doesn't handle stacks: see the docs.The text was updated successfully, but these errors were encountered: