torch-mlir/frontends/pytorch/test/node_import
Sean Silva 179105ca3e Add basic MLP's to the e2e curriculum.
These tests pass on the reference backend.

- Add aten.linear op + shape xfer function + ATen->Linalg lowering.
 - Note: this needs to be more automated, and needs to cover more cases.
 - Current not implemented caveats:
  - size-1 broadcasting for bias vector (either static-size-1 or ? case)
  - higher-rank aten.linear ops (not produced by torch.nn.Linear though)
  - type promotion (still don't even know the exact rules here)
- Add folder for torch.derefine op. Now the inliner can clean it up as
  it inlines. (call boundaries are a main place we need to insert
  torch.derefine) This is brittle -- the other important case is control
  flow which will need to be handled via an extension to
  RefineTypes.cpp (as will more robust call handling). River has an
  in-flight patch to update it to the new dataflow framework so I didn't
  want to do anything intrusive here.
    - Also adjust torch.derefine syntax to use the keyword `to` instead of
      `->`, as most type-only, cast-like ops do.
2021-04-27 12:18:54 -07:00
..
README.md Rename tests to match the code they test 2021-02-25 13:31:33 -08:00
add3.py Properly model "derefinement". 2021-03-03 15:09:44 -08:00
debug-info.py Properly model "derefinement". 2021-03-03 15:09:44 -08:00
elif.py Properly model "derefinement". 2021-03-03 15:09:44 -08:00
errors.py Properly model "derefinement". 2021-03-03 15:09:44 -08:00
function-derefine.py Add basic MLP's to the e2e curriculum. 2021-04-27 12:18:54 -07:00
if.py Add basic MLP's to the e2e curriculum. 2021-04-27 12:18:54 -07:00
list.py Properly model "derefinement". 2021-03-03 15:09:44 -08:00
loop.py Add basic MLP's to the e2e curriculum. 2021-04-27 12:18:54 -07:00
prim.py Miscellaneous changes while trying to work on ResNet18 2021-04-27 11:51:11 -07:00
tuple.py Properly model "derefinement". 2021-03-03 15:09:44 -08:00
types-bool.py Properly model "derefinement". 2021-03-03 15:09:44 -08:00
types-none.py Properly model "derefinement". 2021-03-03 15:09:44 -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.