torch-mlir/frontends/pytorch/csrc/builder
Sean Silva 59a3f46795 Add support for prim.NumToTensor
With this, we can import BERT!
```
pt_util ~/tmp/bert.pt  --import --exported-name=forward \
| npcomp-opt -torch-globalize-object-graph -inline -symbol-dce
```
https://gist.github.com/silvasean/fe7735ff5d065cc9216f7b0346d0e977

The test case here is a bit unconventional -- it isn't actually valid
Python. To figure out how to generate it I had to go search the PyTorch
codebase for "NumToTensor" and work backward. In this case I found
this
[code](649760e5f1/torch/csrc/jit/frontend/ir_emitter.cpp (L464))
which via a wild guess I was able to turn into a test case.

In this case it didn't take me too long, but when doing this kind of
"add a bunch of trivial stuff to bring up a real model", I'm starting to
think that we might skimp on test cases when it's fairly trivial and not
obvious how to test with a small test.
2021-02-26 10:16:56 -08:00
..
acap_dispatch.cpp adapt acap_dispatch to latest pytorch nightly ("1.9.0.dev20210215+cpu") 2021-02-18 11:13:29 -08:00
acap_dispatch.h Make torch_mlir compatible with binary PyTorch installations. 2020-12-14 09:51:00 -08:00
class_annotator.cpp Add ability to annotate TorchScript classes. 2021-02-25 11:28:34 -08:00
class_annotator.h Add ability to annotate TorchScript classes. 2021-02-25 11:28:34 -08:00
debug.cpp Delete old PyTorch 1.3 type dispatch oriented code paths. 2020-11-12 22:27:05 -08:00
debug.h Delete old PyTorch 1.3 type dispatch oriented code paths. 2020-11-12 22:27:05 -08:00
func_builder.cpp Add support for prim::GetAttr/SetAttr/CallMethod/If 2021-02-04 17:01:47 -08:00
func_builder.h Add initial TorchScript module importer 2021-01-28 11:55:17 -08:00
graph_importer.cpp Add support for prim::GetAttr/SetAttr/CallMethod/If 2021-02-04 17:01:47 -08:00
graph_importer.h Add support for prim::GetAttr/SetAttr/CallMethod/If 2021-02-04 17:01:47 -08:00
ivalue_importer.cpp Add Conv2D Torchscript Import Support (#167) 2021-02-25 12:14:00 -08:00
ivalue_importer.h Add ability to annotate TorchScript classes. 2021-02-25 11:28:34 -08:00
mlir_utils.h Add ability to annotate TorchScript classes. 2021-02-25 11:28:34 -08:00
module_builder.cpp Add ability to annotate TorchScript classes. 2021-02-25 11:28:34 -08:00
module_builder.h Add ability to annotate TorchScript classes. 2021-02-25 11:28:34 -08:00
node_importer.cpp Add support for prim.NumToTensor 2021-02-26 10:16:56 -08:00
node_importer.h Add support for prim::GetAttr/SetAttr/CallMethod/If 2021-02-04 17:01:47 -08:00
op_builder.cpp Add prim::Print and fix prim::CallMethod 2021-02-10 15:15:56 -08:00
op_builder.h Add prim::Print and fix prim::CallMethod 2021-02-10 15:15:56 -08:00
python_bindings.cpp Add ability to annotate TorchScript classes. 2021-02-25 11:28:34 -08:00
torch_to_mlir_utils.cpp Extend GlobalizeObjectGraph to handle torch.prim.GetAttr returning NnModuleType 2021-02-19 10:23:25 -08:00
torch_to_mlir_utils.h Add support for prim::GetAttr/SetAttr/CallMethod/If 2021-02-04 17:01:47 -08:00