Skip to content

Commit

Permalink
changes from apache#8131 (#228)
Browse files Browse the repository at this point in the history
  • Loading branch information
ylc authored Sep 28, 2021
1 parent 5203272 commit 561ac46
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions python/tvm/relay/op/contrib/tensorrt.py
Original file line number Diff line number Diff line change
Expand Up @@ -733,8 +733,12 @@ 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))
if (
not isinstance(args[1], relay.Constant)
or len(args[1].checked_type.shape) != 0
or args[1].data.numpy().item() != 0.0
):
logger.info("nn.pad: pad value is %s but must be 0.0.", args[1])
return False
if len(attrs.pad_width) not in [4, 5]:
logger.info("nn.pad: can only pad 4D or 5D inputs")
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/contrib/tensorrt/tensorrt_ops.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1057,7 +1057,7 @@ class ReshapeOpConverter : public TensorRTOpConverter {

class PadOpConverter : public TensorRTOpConverter {
public:
PadOpConverter() : TensorRTOpConverter({kTensor}) {}
PadOpConverter() : TensorRTOpConverter({kTensor, kWeight}) {}

void Convert(TensorRTOpConverterParams* params) const {
auto input = params->inputs.at(0).tensor;
Expand Down

0 comments on commit 561ac46

Please sign in to comment.