Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

From _torch_mlir import _get_mlir ERROR #196

Closed
shoveller86 opened this issue Mar 27, 2021 · 3 comments
Closed

From _torch_mlir import _get_mlir ERROR #196

shoveller86 opened this issue Mar 27, 2021 · 3 comments

Comments

@shoveller86
Copy link

shoveller86 commented Mar 27, 2021

I have successfully build the llvm, mlir , and pytorch front, generate the _mlir and _torch_mlir *.so file. And I have add thems into PATHPYTHON . But when I test, there exist some error:

Import Error

 import npcomp.frontends.pytorch as torch_mlir
  File "mlir-npcomp/build/python/npcomp/frontends/pytorch/__init__.py", line 8, in <module>
    from _torch_mlir import _get_mlir
ImportError: cannot import name '_get_mlir' from '_torch_mlir' (mlir-npcomp/build/python/_torch_mlir.cpython-37m-x86_64-linux-gnu.so)

The _torch_mlir module can be import successfully in python, I have test help(_torch_mlir) and type(_torch_mlir) in python, but the printed result not found _get_mlir function.

code

import npcomp.frontends.pytorch as torch_mlir

dev = torch_mlir.mlir_device()
t0 = torch.randn((4,4), device=dev)
t1 = torch.randn((4,4)).to(dev)
t2 = t0 + t1
t2_mlir = torch_mlir.get_mlir( t2 )
t2_cpu = t2.to('cpu')

@silvasean
Copy link
Contributor

Docs were out of date. Just updated them: b0ac040

@shoveller86
Copy link
Author

Docs were out of date. Just updated them: b0ac040

Thank you, This can be run. I have a question that why the data type of torch-mlir is represented as np.ndarray, not tensor directly ?

@silvasean
Copy link
Contributor

Tensor is not mutable.

rsuderman pushed a commit that referenced this issue May 17, 2024
…ering (#3351)

Addresses [Shark-Turbine
#196](nod-ai/SHARK-TestSuite#196)

Related tracker [Shark-Turbine
#566](nod-ai/SHARK-ModelDev#566)

Related onnx.Resize issues [Shark-Turbine
#616](nod-ai/SHARK-ModelDev#616)
BaneTrifa pushed a commit to BaneTrifa/torch-mlir that referenced this issue May 24, 2024
…ering (llvm#3351)

Addresses [Shark-Turbine
llvm#196](nod-ai/SHARK-TestSuite#196)

Related tracker [Shark-Turbine
llvm#566](nod-ai/SHARK-ModelDev#566)

Related onnx.Resize issues [Shark-Turbine
llvm#616](nod-ai/SHARK-ModelDev#616)
sjarus pushed a commit to sjarus/torch-mlir that referenced this issue Jun 6, 2024
…ering (llvm#3351)

Addresses [Shark-Turbine
llvm#196](nod-ai/SHARK-TestSuite#196)

Related tracker [Shark-Turbine
llvm#566](nod-ai/SHARK-ModelDev#566)

Related onnx.Resize issues [Shark-Turbine
llvm#616](nod-ai/SHARK-ModelDev#616)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants