Skip to content

Commit

Permalink
Fix crash in PadFusion transform (#18544)
Browse files Browse the repository at this point in the history
This makes a minimal change to address a crash caused by the PadFusion
pass. This pass assumed that the "pads" attribute of a child node
existed, and it now skips when it's missing.
  • Loading branch information
jeffbloo authored and sumitsays committed Nov 22, 2023
1 parent 3f0ebd6 commit 4dbe6c9
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions onnxruntime/core/optimizer/pad_fusion.cc
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ bool PadFusion::SatisfyCondition(const Graph& graph, const Node& node, const log
return false;
}

// This pass currently assumed that this attribute already exists on the child node
if (child_node.GetAttributes().find("pads") == child_node.GetAttributes().end()) {
return false;
}

const NodeAttributes& pad_attributes = node.GetAttributes();
if (pad_attributes.find("mode") != pad_attributes.end() &&
pad_attributes.at("mode").s() != "constant") {
Expand Down

0 comments on commit 4dbe6c9

Please sign in to comment.