pytorch/tools/codegen/api
Jiakai Liu de284b6d35 [pytorch][codegen] add autograd data model (#48249)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/48249

Introduced autograd related data models at tools.codegen.api.autograd.

Migrated load_derivatives.py to produce the new data models from derivatives.yaml.
It has clean mypy-strict result.

Changed both gen_autograd_functions.py and gen_variable_type.py to consume
the new data model.

Added type annotations to gen_autograd_functions.py - it has clean mypy-strict
result except for the .gen_autograd import (so haven't added it to the strict
config in this PR).

To limit the scope of the PR, gen_variable_type.py is not refactored, and the
main structure of load_derivatives.py / gen_autograd_functions.py is kept. We
only make necessary changes to make it work.

Confirmed byte-for-byte compatible with the old codegen:

```
Run it before and after this PR:
  .jenkins/pytorch/codegen-test.sh <baseline_output_dir>
  .jenkins/pytorch/codegen-test.sh <test_output_dir>

Then run diff to compare the generated files:
  diff -Naur <baseline_output_dir> <test_output_dir>
```

Test Plan: Imported from OSS

Reviewed By: ezyang

Differential Revision: D25086561

Pulled By: ljk53

fbshipit-source-id: 1f43ab0931d9814c24683b9a48ca497c5fc3d729
2020-11-19 21:47:05 -08:00
..
__init__.py
autograd.py [pytorch][codegen] add autograd data model (#48249) 2020-11-19 21:47:05 -08:00
cpp.py [pytorch] factor out return_names api (#47437) 2020-11-09 12:39:37 -08:00
dispatcher.py Fix NativeFunctions.h for c10-full ops (#46090) 2020-10-14 06:32:36 -07:00
meta.py Structured kernel definitions (#45277) 2020-11-17 15:24:43 -08:00
native.py Fix NativeFunctions.h for c10-full ops (#46090) 2020-10-14 06:32:36 -07:00
python.py [pytorch][codegen] simplify python signature creation logic (#47977) 2020-11-18 12:26:50 -08:00
types.py Structured kernel definitions (#45277) 2020-11-17 15:24:43 -08:00