Commit Graph

24 Commits

Author SHA1 Message Date
fc0376e8b1 [BE][2/6] fix typos in test/ (test/test_*.py) (#157636)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/157636
Approved by: https://github.com/yewentao256, https://github.com/mlazos
ghstack dependencies: #156311, #156609
2025-07-09 11:02:23 +00:00
cyy
df458be4e5 [4/N] Apply py39 ruff and pyupgrade fixes (#143257)
```torch/fx/passes/annotate_getitem_nodes.py``` was changed to support the new type hinting annotations.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/143257
Approved by: https://github.com/justinchuby, https://github.com/albanD
2025-01-04 10:47:51 +00:00
1effabe257 Support per-parameter test decoration (#91658)
Continuation of #79979.

Fixes #79161

This PR does the following:
* Expands the `parametrize_fn()` signature from returning a 3-tuple of `(test, test_name, param_kwargs)` to returning a 4-tuple of `(test, test_name, param_kwargs, decorator_fn)`. Expected signature for the addition is `decorator_fn(param_kwargs) -> List[decorator]` i.e. given the full set of test params, return a list of decorators to apply.
    * `modules`, `ops`, and `parametrize` now fit the new signature, returning `decorator_fn`s instead of applying decorators themselves.
    * `instantiate_parametrized_tests()` and `instantiate_device_type_tests()` now call the returned `decorator_fn`, passing in the full set of `param_kwargs` (after composition + `device` / `dtype` additions) and applying the returned decorators.
    * Composing multiple `parametrize_fn`s also composes the corresponding `decorator_fn`s; the composed `decorator_fn` simply concatenates the decorator lists returned by the constituents.
* Expands `DecorateInfo.is_active` to support callables:
```python
DecorateInfo(
    unittest.expectedFailure, "TestOps", "test_python_ref_executor",
    device_type='cuda', active_if=lambda params: params['executor'] == 'nvfuser'
),
```
* Adds several tests to `test/test_testing.py` ensuring proper decoration using `@parametrize`, `@modules`, and `@ops`.
* (minor) Fixes a couple `ModuleInfo` naming oddities uncovered during testing.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/91658
Approved by: https://github.com/malfet
2023-01-04 21:08:32 +00:00
edc5bb5fbe Only populate real_value_cache during export (#90468)
Fixes https://github.com/pytorch/torchdynamo/issues/1950

Signed-off-by: Edward Z. Yang <ezyang@fb.com>

Pull Request resolved: https://github.com/pytorch/pytorch/pull/90468
Approved by: https://github.com/voznesenskym
2022-12-15 02:28:21 +00:00
686555b663 [maskedtensor] port torch/_masked into torch/masked (#85515)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/85515
Approved by: https://github.com/cpuhrsch
2022-09-26 23:41:13 +00:00
0adf070574 Use scatter_reduce to support masked reductions on sparse COO tensors (sum, prod, amin, amax)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/75454

Approved by: https://github.com/cpuhrsch
2022-05-06 15:40:22 +00:00
381e08309f Revert "Use scatter_reduce to support masked reductions on sparse COO tensors (sum, prod, amin, amax)"
This reverts commit fc2a2e8b7271b258f5f394c94e9154ebef4769e4.

Reverted https://github.com/pytorch/pytorch/pull/75454 on behalf of https://github.com/b0noI
2022-05-04 22:31:31 +00:00
fc2a2e8b72 Use scatter_reduce to support masked reductions on sparse COO tensors (sum, prod, amin, amax)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/75454

Approved by: https://github.com/cpuhrsch
2022-05-03 23:17:07 +00:00
e61b2e12e1 Support masked sum on CSR tensors [CPU, CUDA]
Pull Request resolved: https://github.com/pytorch/pytorch/pull/72633

Approved by: https://github.com/cpuhrsch
2022-04-08 20:07:18 +00:00
31ed77b769 Revert "Support masked sum on CSR tensors [CPU, CUDA]"
This reverts commit 5c28216aeac2ce016609c2feb88128057aa64eff.

Reverted https://github.com/pytorch/pytorch/pull/72633 on behalf of https://github.com/b0noI
2022-04-07 23:34:58 +00:00
5c28216aea Support masked sum on CSR tensors [CPU, CUDA]
Pull Request resolved: https://github.com/pytorch/pytorch/pull/72633

Approved by: https://github.com/cpuhrsch
2022-04-07 17:08:35 +00:00
f6b9a1d4fb Revert "Support masked sum on CSR tensors [CPU, CUDA]"
This reverts commit cda3f586d0b1189c5c4175a503f99f374d1fcce2.

Reverted https://github.com/pytorch/pytorch/pull/72633 on behalf of https://github.com/janeyx99
2022-04-04 22:06:19 +00:00
cda3f586d0 Support masked sum on CSR tensors [CPU, CUDA]
Pull Request resolved: https://github.com/pytorch/pytorch/pull/72633

Approved by: https://github.com/cpuhrsch
2022-04-04 19:23:45 +00:00
ef71046f9c masked std
Pull Request resolved: https://github.com/pytorch/pytorch/pull/74523

Approved by: https://github.com/cpuhrsch
2022-03-30 16:30:41 +00:00
ebeea9e2ea Support masked sum on sparse COO tensors.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/71239

Approved by: https://github.com/cpuhrsch
2022-03-25 18:26:39 +00:00
327029b080 torch.where variant that supports sparse tensor inputs
Pull Request resolved: https://github.com/pytorch/pytorch/pull/74458

Approved by: https://github.com/cpuhrsch
2022-03-21 20:27:39 +00:00
5f310c5e27 Testing of masked reductions on mixed layout inputs. (#72398)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/72398

The design of this feature is discussed in https://github.com/pytorch/pytorch/pull/71239#discussion_r787292751

Test Plan: Imported from OSS

Reviewed By: george-qi

Differential Revision: D34408881

Pulled By: cpuhrsch

fbshipit-source-id: a362d4220957ea38b7e442df4ecf260ffe682eab
(cherry picked from commit 7fb3611130c08f1aa6ea708ca838708c13b0f01c)
2022-02-25 05:32:47 +00:00
b40dbdc49f Fix test ownership lint (#71554)
Summary:
I noticed after creating https://github.com/pytorch/pytorch/issues/71553 that the test ownership lint was not working properly.

This fixes my egregious mistake and fixes the broken lints.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/71554

Reviewed By: malfet

Differential Revision: D33690732

Pulled By: janeyx99

fbshipit-source-id: ba4dfbcd98038e4afd63e326832ae40935d2501e
(cherry picked from commit 1bbc3d343ac143f10b3d4052496812fccfd9e853)
2022-01-21 18:24:42 +00:00
370d0afc1b Strided masked var. (#68738)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/68738

Test Plan: Imported from OSS

Reviewed By: davidberard98

Differential Revision: D32767155

Pulled By: cpuhrsch

fbshipit-source-id: a5c095103405fbfc28b9f4fd624bdbbc45e7f715
2021-12-01 19:19:37 -08:00
1842364b30 Strided masked normalize. (#68694)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/68694

Test Plan: Imported from OSS

Reviewed By: samdow

Differential Revision: D32724552

Pulled By: cpuhrsch

fbshipit-source-id: 82f579a86b0b265e0b9b3715a8a327b775dd55e1
2021-12-01 10:45:16 -08:00
fb63bb60ec Strided masked norm. (#68584)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/68584

Test Plan: Imported from OSS

Reviewed By: pbelevich

Differential Revision: D32581285

Pulled By: cpuhrsch

fbshipit-source-id: 896ee1e58957b46c2f6a16a170adff4cb3b8da62
2021-11-29 14:23:27 -08:00
d0eff8d846 Strided masked softmin. (#68463)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/68463

Test Plan: Imported from OSS

Reviewed By: dagitses

Differential Revision: D32576497

Pulled By: cpuhrsch

fbshipit-source-id: 286edb2e7a5415df76858c69d0312743437b0fd8
2021-11-19 20:51:42 -08:00
af564e73b8 Strided masked log_softmax. (#68461)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/68461

Test Plan: Imported from OSS

Reviewed By: dagitses, zou3519

Differential Revision: D32569961

Pulled By: cpuhrsch

fbshipit-source-id: 5d262adacf239dace4a28de85af4b602e36f17f0
2021-11-19 16:28:35 -08:00
2cab77f810 Masked normalization infrastructure and strided masked softmax (#68333)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/68333

Test Plan: Imported from OSS

Reviewed By: dagitses, ZolotukhinM

Differential Revision: D32564435

Pulled By: cpuhrsch

fbshipit-source-id: 4d4662323ceffd12c210b7e931682d0442578157
2021-11-19 12:41:22 -08:00