pytorch/tools/codegen
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
..
api [pytorch][codegen] add autograd data model (#48249) 2020-11-19 21:47:05 -08:00
selective_build [RFC] Switch PyTorch Selective Build (Custom Build) to use the SelectiveBuilder abstraction (#45722) 2020-10-18 15:10:42 -07:00
__init__.py
code_template.py
gen.py [pytorch][codegen] move is_abstract property to NativeFunction model (#48252) 2020-11-19 12:30:13 -08:00
local.py Byte-for-byte compatibility fixes in codegen (#44879) 2020-09-25 08:06:50 -07:00
model.py [pytorch][codegen] add autograd data model (#48249) 2020-11-19 21:47:05 -08:00
utils.py [pytorch][codegen] add autograd data model (#48249) 2020-11-19 21:47:05 -08:00