fixstars-fujinami commented on a change in pull request #8131:
URL: https://github.com/apache/tvm/pull/8131#discussion_r639399119



##########
File path: python/tvm/relay/op/contrib/tensorrt.py
##########
@@ -723,8 +723,9 @@ def pad_annotate_fn(expr):  # pylint: 
disable=unused-variable
     if attrs.pad_mode != "constant":
         logger.info("nn.pad: pad mode is %s but must be constant.", 
attrs.pad_mode)
         return False
-    if float(attrs.pad_value) != 0.0:
-        logger.info("nn.pad: pad value is %f but must be 0.0.", 
float(attrs.pad_value))
+    assert isinstance(args[1], relay.Constant)
+    if len(args[1].checked_type.shape) == 0 and args[1].data.numpy().item() != 
0.0:

Review comment:
       I think it's better to check type of pad_value with if instead of assert 
because it may be Expr.
   
   I suggest the following code, including the fix of checking the shape of 
pad_value,
   
   ```suggestion
       if (not isinstance(args[1], relay.Constant) or
           len(args[1].checked_type.shape) != 0 or
           args[1].data.numpy().item() != 0.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.

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


Reply via email to