Anthony Barbier
bf7e290854
Add __main__ guards to jit tests ( #154725 )
...
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
2025-06-16 10:28:45 +00:00
PyTorch MergeBot
20912673a6
Revert "Add __main__ guards to jit tests ( #154725 )"
...
This reverts commit 1a55fb0ee8 .
Reverted https://github.com/pytorch/pytorch/pull/154725 on behalf of https://github.com/malfet due to This added 2nd copy of raise_on_run to common_utils.py which caused lint failures, see https://github.com/pytorch/pytorch/actions/runs/15445374980/job/43473457466 ([comment](https://github.com/pytorch/pytorch/pull/154725#issuecomment-2940503905 ))
2025-06-04 15:42:52 +00:00
Anthony Barbier
1a55fb0ee8
Add __main__ guards to jit tests ( #154725 )
...
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/Skylion007
2025-06-04 14:44:08 +00:00
Oguz Ulgen
920f0426ae
Add None return type to init -- tests rest ( #132376 )
...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/132376
Approved by: https://github.com/jamesjwu
ghstack dependencies: #132335 , #132351 , #132352
2024-08-01 15:44:51 +00:00
Xuehai Pan
6ff1e43a41
[BE][Easy][13/19] enforce style for empty lines in import segments in test/j*/ ( #129764 )
...
See https://github.com/pytorch/pytorch/pull/129751#issue-2380881501 . Most changes are auto-generated by linter.
You can review these PRs via:
```bash
git diff --ignore-all-space --ignore-blank-lines HEAD~1
```
Pull Request resolved: https://github.com/pytorch/pytorch/pull/129764
Approved by: https://github.com/ezyang
2024-08-01 12:13:42 +00:00
Yuanhao Ji
604c9c5601
Enable UFMT on all of test/jit ( #123623 )
...
Partially addresses #123062
Ran lintrunner on:
- `test/jit`
with command:
```bash
lintrunner -a --take UFMT --all-files
```
Pull Request resolved: https://github.com/pytorch/pytorch/pull/123623
Approved by: https://github.com/ezyang
2024-04-11 23:45:05 +00:00
Denis Yaroshevskiy
2c9c57c061
Only profiling when it's enabled. ( #121404 )
...
Summary:
The profiling, even when disabled, takes up about 1.5% cpu for a model I'm looking into.
This patch just splits into with/without profile runs.
The potential downside is that now the script can't enable profiling in itself. It doesn't seem to be used anywhere. If that's a crusial usecase, we can do something about it but ideally we wouldn't.
Test Plan:
Link with profiles:
https://fburl.com/scuba/strobelight_services/ihxsl7pj
```
buck2 run fbcode//caffe2/test/cpp/jit:jit
```
Reviewed By: zhxchen17
Differential Revision: D54066589
Pull Request resolved: https://github.com/pytorch/pytorch/pull/121404
Approved by: https://github.com/zhxchen17
2024-03-08 19:23:14 +00:00
Xuehai Pan
046e88a291
[BE] [3/3] Rewrite super() calls in test ( #94592 )
...
Rewrite Python built-in class `super()` calls. Only non-semantic changes should be applied.
- #94587
- #94588
- #94592
Also, methods with only a `super()` call are removed:
```diff
class MyModule(nn.Module):
- def __init__(self):
- super().__init__()
-
def forward(self, ...):
...
```
Some cases that change the semantics should be kept unchanged. E.g.:
f152a79be9/caffe2/python/net_printer.py (L184-L190)
f152a79be9/test/test_jit_fuser_te.py (L2628-L2635)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/94592
Approved by: https://github.com/ezyang , https://github.com/seemethere
2023-02-12 22:20:53 +00:00
Jane Xu
09c7771e9c
Set test owners for jit tests ( #66808 )
...
Summary:
Action following https://github.com/pytorch/pytorch/issues/66232
Pull Request resolved: https://github.com/pytorch/pytorch/pull/66808
Reviewed By: mrshenli
Differential Revision: D31761414
Pulled By: janeyx99
fbshipit-source-id: baf8c49ff9c4bcda7b0ea0f6aafd26380586e72d
2021-10-25 07:51:10 -07:00
Zhengxu Chen
6b6a27e430
[jit] Add Python API for ScriptProfile ( #57398 )
...
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/57398
Test Plan: Imported from OSS
Reviewed By: gmagogsfm
Differential Revision: D28133577
fbshipit-source-id: dcb8338159a24b00b5c495ecec66a3303d9b4aba
2021-05-25 11:09:18 -07:00