WIP / TST: allow testing torch._numpy under Dynamo (#110401)

Use conditional imports: when running under dynamo, import the original NumPy not torch._numpy. This is what we want to trace, not our implementation.

With this, the test suite passes with and without `PYTORCH_TEST_WITH_DYNAMO=1` (modulo a couple of test modules which are not meant to be compiled, e.g. `test_nep50_examples`). There are two new decorators, `x{fail,pass}ifTorchDynamo`, the `xpass` in most cases indicates a graph break and a fallback to eager for things we do not implement.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/110401
Approved by: https://github.com/lezcano
This commit is contained in:
Evgeni Burovski
2023-10-25 16:02:16 +00:00
committed by PyTorch MergeBot
parent 6fd3659391
commit 5ed4a423de
36 changed files with 1200 additions and 648 deletions

View File

@ -13,3 +13,5 @@ testpaths =
junit_logging_reruns = all
filterwarnings =
ignore:Module already imported so cannot be rewritten.*hypothesis:pytest.PytestAssertRewriteWarning
strict_xfail = True