mirror of https://github.com/llvm/torch-mlir
59a3f46795
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](
|
||
---|---|---|
.. | ||
acap_dispatch.cpp | ||
acap_dispatch.h | ||
class_annotator.cpp | ||
class_annotator.h | ||
debug.cpp | ||
debug.h | ||
func_builder.cpp | ||
func_builder.h | ||
graph_importer.cpp | ||
graph_importer.h | ||
ivalue_importer.cpp | ||
ivalue_importer.h | ||
mlir_utils.h | ||
module_builder.cpp | ||
module_builder.h | ||
node_importer.cpp | ||
node_importer.h | ||
op_builder.cpp | ||
op_builder.h | ||
python_bindings.cpp | ||
torch_to_mlir_utils.cpp | ||
torch_to_mlir_utils.h |