Skip to content

Commit d3d1a7d

Browse files
anijain2305wweic
authored andcommitted
[QNN] Fix padding changes due to apache#3739 (apache#3989)
1 parent 1f706b2 commit d3d1a7d

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/relay/pass/pattern_util.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,10 +476,12 @@ static inline Expr AvgPool2D(Expr data, Array<IndexExpr> pool_size, Array<IndexE
476476
return CallNode::make(op, {data}, Attrs(attrs), {});
477477
}
478478

479-
static inline Expr Pad(Expr data, Array<Array<IndexExpr>> pad_width, double pad_value) {
479+
static inline Expr Pad(Expr data, Array<Array<IndexExpr>> pad_width, double pad_value,
480+
std::string pad_mode) {
480481
auto attrs = make_node<PadAttrs>();
481482
attrs->pad_value = pad_value;
482483
attrs->pad_width = std::move(pad_width);
484+
attrs->pad_mode = std::move(pad_mode);
483485
static const Op& op = Op::Get("nn.pad");
484486
return CallNode::make(op, {data}, Attrs(attrs), {});
485487
}

src/relay/qnn/op/convolution.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ Expr Conv2DPadInput(const Expr& data, const QnnConv2DAttrs* param) {
167167
} else {
168168
LOG(FATAL) << "qnn.conv2d does not support " << param->data_layout << " layout";
169169
}
170-
padded_data = Pad(data, pad_width, param->input_zero_point);
170+
padded_data = Pad(data, pad_width, param->input_zero_point, "constant");
171171
}
172172
return padded_data;
173173
}

0 commit comments

Comments
 (0)