lucagrementieri edited a comment on issue #9237:
URL: https://github.com/apache/tvm/issues/9237#issuecomment-943090057


   I am facing a similar problem running the script `from_torch.py` published 
with the tutorial 
https://tvm.apache.org/docs/how_to/compile_models/from_pytorch.html.
   
   When I run the script, I get a `TracerWarning` while tracing the pretrained 
ResNet18 model and the final output of the Realy is very different from the 
PyTorch output.
   
   The `TracerWarning` happens when `tvm` is imported before `torch` even if it 
not used. If `tvm` is imported after `torch` then everything works fine.
   
   The following script works, but if `import tvm` is uncommented, the 
`TracerWarning` appears.
   ```
   # import tvm
   import torch
   import torchvision
   
   model = torchvision.models.resnet18(pretrained=True).eval()
   input_shape = [1, 3, 224, 224]
   input_data = torch.randn(input_shape)
   scripted_model = torch.jit.trace(model, input_data).eval() 
   ```
   
   I'm using the latest version of tvm and I have tested PyTorch 1.7.1, 1.8.2 
and 1.9.1.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@tvm.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to