pytorch/tools/codegen/api
Edward Yang 81c7c3bae5 Add api.structured; switch structured kernels to use const Tensor& everywhere (#51490)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/51490

Mutable Tensor ref is a source of endless confusion for kernel writers;
if we're going to make everyone rewrite their kernels, might as well
also get rid of mutable Tensor& while we're at it.

This is a refactor-then-small-update double whammy.  The refactor
is to separate tools.codegen.api.structured from api.native for
describing the type signatures of structured kernels (previously,
I was naughtily reusing native for this purpose--now I need it to
behave differently as Tensor).  This started off as a copy paste, but
since there are not that many structured kernels so far I could delete
all of the legacy logic from native that didn't make sense (without
having to go out and fix all the use sites all at once).

One more small addition was teaching translate to convert Tensor& to const Tensor&.

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

Test Plan: Imported from OSS

Reviewed By: bhosmer

Differential Revision: D26182413

Pulled By: ezyang

fbshipit-source-id: ed636866add3581179669cf9283f9835fcaddc06
2021-02-03 14:03:46 -08:00
..
__init__.py Rewrite of ATen code generator (#42629) 2020-08-31 09:00:22 -07:00
autograd.py [pytorch][codegen] migrate gen_variable_type to new data model (#49735) 2021-01-05 14:12:39 -08:00
cpp.py [PyTorch] Pass TensorOptions by value (#51165) 2021-02-01 12:40:08 -08:00
dispatcher.py Remove codegen logic to support non-c10-full ops (#49164) 2021-01-06 14:17:36 -08:00
meta.py Introduce tools.codegen.api.translate (#49122) 2020-12-16 16:18:40 -08:00
native.py [pytorch] fix ConstRefCType usage in codegen/api/native.py (#50742) 2021-01-20 15:01:37 -08:00
python.py Remove codegen logic to support non-c10-full ops (#49164) 2021-01-06 14:17:36 -08:00
structured.py Add api.structured; switch structured kernels to use const Tensor& everywhere (#51490) 2021-02-03 14:03:46 -08:00
translate.py Add api.structured; switch structured kernels to use const Tensor& everywhere (#51490) 2021-02-03 14:03:46 -08:00
types.py Add at::cpu namespace of functions for structured kernels (#49505) 2021-01-22 13:11:59 -08:00