masahi edited a comment on issue #6607:
URL: https://github.com/apache/incubator-tvm/issues/6607#issuecomment-702440123


   The problem is that you are using `torch.jit.script`.  As you see in the 
warning, we cannot tell the input type of PyTorch modules if they are scripted, 
so all we can do is to assign a default type (which is float32 if it is not 
provided). 
   
   You need to use `torch.jit.trace` or provide the types of inputs explicitly. 
One of the following change should fix your problem.
   
   * Use tracing instead of scripting
   ```
    scripted_model = torch.jit.trace(init_model, example_inputs=[vector1, 
vector2])
   ```
   * Provide types for each inputs as below. For this to work you need to have 
a recent enough TVM install, after this commit 
https://github.com/apache/incubator-tvm/pull/6546
   ```
   shape_list = [(input1_name, ((10,), "int32")), (input2_name, ((10,), 
"int32"))]
   ```
   * Change the default type to int32, by
   ```
      model, params = relay.frontend.from_pytorch(..., default_dtype="int32")
   ```


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to