pytorch
99a2a0b1 - Implement torch.diagonal for named tensors (#30193)

Commit
5 years ago
Implement torch.diagonal for named tensors (#30193) Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/30193 Featuring: - Added a NoNamesGuard::reset() function that sets NamesMode back to what it was before the guard. This makes it so that we don't have to create a new context to run code in an unnamed way. - Added a diagonal(Tensor, *, Dimname outdim, Dimname dim1, Dimname dim2, int64_t offset=0) overload. All of the non-tensor arguments are keyword only for readability purposes; something like `tensor.diagonal("A", "B", "C")` would be really confusing. Test Plan: - Added new tests Differential Revision: D18638363 Pulled By: zou3519 fbshipit-source-id: ea37b52a19535f84a69be38e95e569e88f307381
Author
Parents
Loading