Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Relay] Move pad value extraction past null pointer check #14445

Merged
merged 1 commit into from
Mar 31, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/relay/transforms/fold_explicit_padding.cc
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,6 @@ class SimplifyExplicitPad {

const Expr& pv = pad_node->args[1];
const ConstantNode* pad_value = pv.as<ConstantNode>();
auto pad_scalar = ToScalar(pad_value->data);

if (node_map.find(qconv2d_) != node_map.end()) {
Attrs attrs = MakeConv2D3DAttrs(param, call_node->attrs.as<Conv2DAttrs>());
Expand All @@ -251,6 +250,7 @@ class SimplifyExplicitPad {

if (param->pad_mode == "constant" && pad_value) {
Attrs attrs;
auto pad_scalar = ToScalar(pad_value->data);
if (pad_scalar == 0.0) {
// Fold Padding and Conv/AvgPool only if pad_value == 0.
if (node_map.count(conv_)) {
Expand Down