You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by "Thrsu (via GitHub)" <gi...@apache.org> on 2023/10/16 02:18:40 UTC

[PR] [Unity] [Bugfix] Fix TypeError in interpolate caused by scale_factor as tuple [tvm]

Thrsu opened a new pull request, #15935:
URL: https://github.com/apache/tvm/pull/15935

   This pull request addresses a TypeError that occurs in the interpolate function when the scale_factor parameter is of type tuple. The current implementation fails to handle cases where scale_factor is a tuple, resulting in the error message: "TypeError: int() argument must be a string, a bytes-like object or a number, not 'list'."
   
   This fix addresses the underlying problem and allows the interpolate function to handle both scalar and tuple values for the scale_factor parameter without raising a TypeError.
   
   And this bug can be reproduced by the following script:
   ```python
   import torch
   from torch import fx
   from torch.nn import Module
   import tvm
   from tvm import relax
   from tvm.relax.frontend.torch import from_fx
   
   input_data = torch.randn([1, 2, 4, 4], dtype=torch.float32)
   class interpolate(Module):
       def forward(self, input):
           return torch.nn.functional.interpolate(input, size=None, scale_factor=(2.0, 1.0), mode='bilinear', align_corners=False,)
   
   model = interpolate().float()
   input_data = [input_data]
   input_info = list(zip([list(inp.shape) for inp in input_data], [str(inp.dtype) for inp in input_data]))
   fx_model : torch.fx.GraphModule = fx.symbolic_trace(model)
   with torch.no_grad():
       mod = from_fx(fx_model, input_info)
   ```


-- 
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-unsubscribe@tvm.apache.org

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


Re: [PR] [Unity] [Bugfix] Fix TypeError in interpolate caused by scale_factor as tuple [tvm]

Posted by "Hzfengsy (via GitHub)" <gi...@apache.org>.
Hzfengsy merged PR #15935:
URL: https://github.com/apache/tvm/pull/15935


-- 
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-unsubscribe@tvm.apache.org

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