torch-mlir/frontends/pytorch/test/node_import
Sean Silva df4c5764da Add support for `prim::unchecked_cast`.
This arises when casting optionals, which happens a lot especially
around handling of default arguments (python `if arg is None` idiom).

In this case, the offending code for the model is in max_pool2d:
[code link](b3bf08e67f/torch/nn/functional.py (L657))
2021-03-02 16:01:34 -08:00
..
README.md Rename tests to match the code they test 2021-02-25 13:31:33 -08:00
add3.py Rename tests to match the code they test 2021-02-25 13:31:33 -08:00
debug-info.py Rename tests to match the code they test 2021-02-25 13:31:33 -08:00
elif.py Rename tests to match the code they test 2021-02-25 13:31:33 -08:00
errors.py Rename tests to match the code they test 2021-02-25 13:31:33 -08:00
if.py Rename tests to match the code they test 2021-02-25 13:31:33 -08:00
list.py Rename tests to match the code they test 2021-02-25 13:31:33 -08:00
loop.py Add support for prim::Loop op. 2021-03-02 16:01:34 -08:00
prim.py Add support for `prim::unchecked_cast`. 2021-03-02 16:01:34 -08:00
tuple.py Rename tests to match the code they test 2021-02-25 13:31:33 -08:00
types-bool.py Rename tests to match the code they test 2021-02-25 13:31:33 -08:00
types-none.py Rename tests to match the code they test 2021-02-25 13:31:33 -08:00

README.md

node_import

Most of the tests in this directory test the importing of TorchScript torch::jit::Graph's.

However, TorchScript graphs don't really correspond directly to anything on the MLIR side. They are a weird combination of a context, builder, and function and just holds a torch::jit::Block. It is torch::jit::Node and torch::jit::Block which form the recursive structure analogous to MLIR's operation/region/block.

  • torch::jit::Node == mlir::Operation,
  • torch::jit::Block == mlir::Region containing single mlir::Block

Hence the name of this directory and the corresponding code in node_importer.h/cpp.