Lyken17 commented on pull request #10439:
URL: https://github.com/apache/tvm/pull/10439#issuecomment-1056647885


   Thanks for the explaination.  But such dtype information is missing when 
using `from_pytorch` and `from_onnx`. 
   
   ```python
   import numpy as np
   
   import torch
   import torch.nn as nn
   
   import tvm
   from tvm import relay
   from tvm.contrib import graph_executor
   
   net = nn.Sequential(
       nn.Conv2d(3, 3, 3, padding=1, groups=3)
   )
   
   input_shape = [1, 3, 32, 32]
   input_data = torch.randn(input_shape)
   input_name = "input0"
   shape_list = [(input_name, input_data.shape)]
   
   scripted_model = torch.jit.trace(net, input_data).eval()
   fmod, params = relay.frontend.from_pytorch(scripted_model, shape_list)
   
   mod = relay.transform.InferType()(fmod)
   bwd_expr = relay.transform.gradient(mod["main"], mode="first_order")
   
   bwd_mod = tvm.IRModule.from_expr(bwd_expr)
   bwd_mod = relay.transform.InferType()(bwd_mod)
   ```
   
   


-- 
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: [email protected]

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


Reply via email to