shingjan commented on code in PR #12134:
URL: https://github.com/apache/tvm/pull/12134#discussion_r942757423


##########
python/tvm/relay/frontend/pytorch.py:
##########
@@ -1925,16 +1925,25 @@ def pad_common(self, mode, pad_value, inputs, 
input_types):
         for pad in paddings:
             const_paddings.append([])
             for p in pad:
-                if not isinstance(p, int):
+                if isinstance(p, _expr.Expr):
                     p = int(_infer_value(p, {}).numpy())
+                elif isinstance(p, float):

Review Comment:
   This is an interesting bug I am working on. When I changed this 
[line](https://github.com/apache/tvm/blob/f4cf7b9a8a9c926802f6e4122415c84c83fe89b5/python/tvm/relay/frontend/pytorch.py#L1908)
 to `padding = [pad_value] * pad_len`, the padded tensor has the correct 
pad_value filled in but the size is wrong. When set to `padding = [0] * 
pad_len`, the padded tensor has the correct size but the pad_value is filled 
with all zero. The root cause of this error I think is from the fact that this 
padding impl may have some assumptions that only work when `pad_value` is set 
to 0.



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