This PR is part of a series attempting to re-submit https://github.com/pytorch/pytorch/pull/134592 as smaller PRs.
In jit tests:
- Add and use a common raise_on_run_directly method for when a user runs a test file directly which should not be run this way. Print the file which the user should have run.
- Raise a RuntimeError on tests which have been disabled (not run)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/154725
Approved by: https://github.com/clee2000
This PR adds refs for the following ops:
- `torch.triu`
- `torch.tril`
- `torch.triu_indices`
- `torch.tril_indices`
- `torch.nn.functional.pairwise_distance`
- `torch.nn.functional.pdist`
It adds OpInfos for
- `torch.triu_indices`
- `torch.tril_indices`
Note that these were already tested in `test/test_tensor_creation_ops.py`
but for the ref tests we need the OpInfos.
Finally, it improves documentation for PairwiseDistance and adds
a missing import to `torch/testing/_internal/opinfo/core.py`.
This started with an attempt to just add the `nn.functional` refs above,
but it turned out that `pdist` was easiest to implement using `triu_indices`
so I added that one and the related functions as well.
~~In the end, I changed the `pdist` implementation to not use `triu_indices`
but kept the other refs.~~
Pull Request resolved: https://github.com/pytorch/pytorch/pull/82819
Approved by: https://github.com/ngimel