Commit Graph

22 Commits

Author SHA1 Message Date
Peter Bell
ae68e455be Enable formatting in all of testing/_internal/opinfo (#83559)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/83559
Approved by: https://github.com/albanD
2022-08-19 12:25:57 +00:00
PyTorch MergeBot
61b2cde527 Revert "Enable formatting in all of testing/_internal/opinfo (#83559)"
This reverts commit a7e6196909.

Reverted https://github.com/pytorch/pytorch/pull/83559 on behalf of https://github.com/peterbell10 due to Stack broke lint
2022-08-19 02:27:03 +00:00
PyTorch MergeBot
107465af2c Revert "Move gradcheck_wrapper and clone_sample funcs into opinfo.core (#83560)"
This reverts commit 5120263703.

Reverted https://github.com/pytorch/pytorch/pull/83560 on behalf of https://github.com/peterbell10 due to Stack broke lint
2022-08-19 02:23:32 +00:00
PyTorch MergeBot
0ddabe56ad Revert "Move RefInfo classes into opinfo.refs (#83563)"
This reverts commit 03ce36e3c1.

Reverted https://github.com/pytorch/pytorch/pull/83563 on behalf of https://github.com/peterbell10 due to Stack broke lint
2022-08-19 02:21:40 +00:00
PyTorch MergeBot
c8730d0a2f Revert "Move torch.linalg opinfos to opinfo.definitions (1/2) (#83547)"
This reverts commit bb86c31e26.

Reverted https://github.com/pytorch/pytorch/pull/83547 on behalf of https://github.com/peterbell10 due to Stack broke lint
2022-08-19 02:18:23 +00:00
PyTorch MergeBot
393137e13f Revert "Move torch.linalg opinfos to opinfo.definitions (2/2) (#83554)"
This reverts commit 1f2efdce15.

Reverted https://github.com/pytorch/pytorch/pull/83554 on behalf of https://github.com/peterbell10 due to Stack broke lint
2022-08-19 02:14:42 +00:00
Peter Bell
1f2efdce15 Move torch.linalg opinfos to opinfo.definitions (2/2) (#83554)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/83554
Approved by: https://github.com/albanD
2022-08-19 01:49:48 +00:00
Peter Bell
bb86c31e26 Move torch.linalg opinfos to opinfo.definitions (1/2) (#83547)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/83547
Approved by: https://github.com/albanD
2022-08-19 01:49:48 +00:00
Peter Bell
03ce36e3c1 Move RefInfo classes into opinfo.refs (#83563)
Given that there is already a clear `op_db`, `python_ref_db` split I
think it makes sense to have the `RefInfo` classes be defined in a
different file.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/83563
Approved by: https://github.com/albanD
2022-08-19 01:49:47 +00:00
Peter Bell
5120263703 Move gradcheck_wrapper and clone_sample funcs into opinfo.core (#83560)
The linalg OpInfos need these, so moving them into core to prevent
circular dependencies.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/83560
Approved by: https://github.com/albanD
2022-08-19 01:49:46 +00:00
Peter Bell
a7e6196909 Enable formatting in all of testing/_internal/opinfo (#83559)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/83559
Approved by: https://github.com/albanD
2022-08-19 01:49:45 +00:00
Fabio Rocha
9e1560821e [primTorch] Refs for pdist, triu and related ops (#82819)
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
2022-08-18 21:52:03 +00:00
Peter Bell
b1e02ae8fc Move PythonRefInfos for torch.fft into opinfo.definitions (#83277)
Ref #82518

The moves `python_ref_db` entries for `torch.fft` into
`opinfo/definitions/fft.py`.

I ran into a problem with `_find_referenced_opinfo` since it's called
at init time for the module, yet relies on the completed op_db list.
This PR fixes the circular dependency by explicitly passing in an
op_db argument which can point to only the locally defined `op_db`.

An alternative solution would be to have a different folder for the
`op_db` and the `python_ref_db` definitions. However that would mean
losing the convenience of having closely related opinfos be in the
same file.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/83277
Approved by: https://github.com/albanD
2022-08-17 18:50:58 +00:00
Peter Bell
5f50289b39 Move OpInfos for torch.fft into opinfo.definitions (#83276)
Ref #82518

This moves the `op_db` entries into `opinfo/definitions/fft.py` and
also appends them to `common_methods_invocations.op_db` so existing
users are unaffected by this change.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/83276
Approved by: https://github.com/albanD
2022-08-17 18:50:58 +00:00
Richard Zou
fc65b2becb Fix error_inputs for linalg.lstsq; assert SampleInput args are tuple, take2 (#83105)
The previous merge attempt failed some trunk tests.

Test Plan:
- wait for tests
Pull Request resolved: https://github.com/pytorch/pytorch/pull/83105
Approved by: https://github.com/Chillee
2022-08-10 17:37:28 +00:00
PyTorch MergeBot
4d95111aa6 Revert "Fix error_inputs for linalg.lstsq; assert SampleInput args are tuple (#83004)"
This reverts commit 21ec288475.

Reverted https://github.com/pytorch/pytorch/pull/83004 on behalf of https://github.com/zou3519 due to this commit failed trunk
2022-08-09 18:04:53 +00:00
Richard Zou
21ec288475 Fix error_inputs for linalg.lstsq; assert SampleInput args are tuple (#83004)
Similar to #82984, this PR fixes the error inputs for linalg.lstsq.
It also also asserts that SampleInput's args must be a
tuple and kwargs (after handling None) must be a dict, and fixes one
other sample input.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/83004
Approved by: https://github.com/Chillee
2022-08-09 14:04:32 +00:00
Peter Bell
5e3d1ef49f Allow ufunc OpInfos to have no reference (#82348)
The `ref` property was moved down from `{Unary,Binary}UfuncInfo` into
`OpInfo` quite some time ago, but `OpInfo` uses `None` to signal no
reference is available while the others use `_NOTHING`. This makes
everything consistently use `None`.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/82348
Approved by: https://github.com/ngimel
2022-08-09 04:38:17 +00:00
PyTorch MergeBot
814c19b266 Revert "Allow ufunc OpInfos to have no reference (#82348)"
This reverts commit 566d734396.

Reverted https://github.com/pytorch/pytorch/pull/82348 on behalf of https://github.com/peterbell10 due to This stack broke macos tests on trunk
2022-08-06 21:09:09 +00:00
Peter Bell
566d734396 Allow ufunc OpInfos to have no reference (#82348)
The `ref` property was moved down from `{Unary,Binary}UfuncInfo` into
`OpInfo` quite some time ago, but `OpInfo` uses `None` to signal no
reference is available while the others use `_NOTHING`. This makes
everything consistently use `None`.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/82348
Approved by: https://github.com/ngimel
2022-08-06 20:01:39 +00:00
Peter Bell
d8ae83ba79 Move OpInfo subclasses into opinfo.core (#82830)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/82830
Approved by: https://github.com/albanD
2022-08-05 15:14:07 +00:00
Peter Bell
4d405517e4 Move OpInfo class into new opinfo folder (#82540)
Ref #82518

Starting small to minimize merge conflicts, this moves the top-level
class definitions and some helper functions into the `opinfos` folder.
It also brings `common_methods_invocations.py` to just below 1MB.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/82540
Approved by: https://github.com/albanD
2022-08-05 15:10:17 +00:00