You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2021/06/03 16:11:49 UTC

[GitHub] [tvm] YuhengHuang42 opened a new issue #8184: [Relay][Frontend][Pytorch] Prelu definition mismatch in pytorch

YuhengHuang42 opened a new issue #8184:
URL: https://github.com/apache/tvm/issues/8184


   ## Description
   
   A similar bug was found in ONNX model, and fixed by this PR: https://github.com/apache/tvm/pull/7208
   
   However, for Pytorch importation, the bug still exists.
   
   By definition: [PRelu definition in pytorch](https://pytorch.org/docs/stable/generated/torch.nn.PReLU.html?highlight=prelu#torch.nn.PReLU), num_parameters can be set at 1 or  the number of channels at input. 
   
   However, currently PReLU in TVM seems to support num_parameters =  number of channels only. So there will be an error if you set num_parameters = 1 while give input channels > 1.
   
   And please notice that **by default** Pytorch set the num_parameters = 1.
   
   (Currently, the workaround is to turn Pytorch model to ONNX model first, and then import the ONNX model.)
   
   ## Code to reproduce
   
   ```python
   import torch
   import tvm 
   from tvm import relay
   
   minimal_example = torch.nn.Sequential(
       torch.nn.PReLU(num_parameters=1)
   )
   minimal_example.eval()
   
   input_shape = (1, 6, 10, 10) 
   random_input = torch.randn(input_shape)
   trace = torch.jit.trace(minimal_example, random_input)
   input_info = [("input0", input_shape)]
   mod, params = tvm.relay.frontend.from_pytorch(trace, input_info)
   ```
   
   ## Environment
   
   TVM version: 0.8.dev0 at cc3d60e6cd4ec674070fd4a5705723c17ee59389
   
   Pytorch version: 1.8.1
   
   OS version: macOS 10.15.7 
   
   
   
    
   


-- 
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:
users@infra.apache.org



[GitHub] [tvm] masahi commented on issue #8184: [Relay][Frontend][Pytorch] Prelu definition mismatch in pytorch

Posted by GitBox <gi...@apache.org>.
masahi commented on issue #8184:
URL: https://github.com/apache/tvm/issues/8184#issuecomment-854216103


   thanks, it would be great if you can send a PR.


-- 
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:
users@infra.apache.org



[GitHub] [tvm] masahi closed issue #8184: [Relay][Frontend][Pytorch] Prelu definition mismatch in pytorch

Posted by GitBox <gi...@apache.org>.
masahi closed issue #8184:
URL: https://github.com/apache/tvm/issues/8184


   


-- 
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:
users@infra.apache.org



[GitHub] [tvm] masahi commented on issue #8184: [Relay][Frontend][Pytorch] Prelu definition mismatch in pytorch

Posted by GitBox <gi...@apache.org>.
masahi commented on issue #8184:
URL: https://github.com/apache/tvm/issues/8184#issuecomment-854216103


   thanks, it would be great if you can send a PR.


-- 
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:
users@infra.apache.org