pytorch/tools/codegen
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
..
api Add api.structured; switch structured kernels to use const Tensor& everywhere (#51490) 2021-02-03 14:03:46 -08:00
selective_build [PyTorch Mobile] Generate Kernel dtype selection code in selected_mobile_ops.h during the build (#49279) 2021-01-06 12:17:32 -08:00
__init__.py
code_template.py
gen.py Add api.structured; switch structured kernels to use const Tensor& everywhere (#51490) 2021-02-03 14:03:46 -08:00
local.py Byte-for-byte compatibility fixes in codegen (#44879) 2020-09-25 08:06:50 -07:00
model.py [pytorch] change codegen dispatch key from string to enum (#51115) 2021-01-27 22:28:52 -08:00
utils.py [pytorch][codegen] add autograd data model (#48249) 2020-11-19 21:47:05 -08:00