ConvolutedDog commented on issue #18573:
URL: https://github.com/apache/tvm/issues/18573#issuecomment-3632484624

   I have checked the following minimal reproduction example, and it runs 
without errors in my environment.
   
   ```python
   import torch
   import torch.nn as nn
   from tvm.relax.frontend.torch import from_exported_program
   
   input_size = 28 * 28
   num_classes = 10
   
   
   class SimpleNet(nn.Module):
       def __init__(self):
           super(SimpleNet, self).__init__()
           self.fc1 = nn.Linear(input_size, 128)
           self.fc2 = nn.Linear(128, num_classes)
   
       def forward(self, x: torch.Tensor):
           x = x.view(x.size(0), -1)
           x = torch.relu(self.fc1(x))
           x = self.fc2(x)
           return x
   
   
   model = SimpleNet()
   example_args = (torch.randn(1, 1, 28, 28).to(torch.device("cpu")),)
   exported_program = torch.export.export(model, example_args)
   output_path = "model.pt2"
   torch.export.save(exported_program, output_path)
   
   
   ##############################
   
   exported_program = torch.export.load("model.pt2")
   mod = from_exported_program(exported_program)
   mod.show()
   
   ```


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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to