Skip to content

Commit 0c235df

Browse files
committed
Fix
Signed-off-by: Justin Chu <[email protected]>
1 parent e69fdf2 commit 0c235df

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

onnxscript/optimizer/_constant_folding.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1034,7 +1034,7 @@ def process_node(self, node: ir.Node) -> Replacement | None:
10341034

10351035
if (
10361036
_is_onnx_op(node, "ConstantOfShape")
1037-
and "ConstantOfShape" not in self.always_fold_ops
1037+
and ("", "ConstantOfShape") not in self.always_fold_ops
10381038
):
10391039
logger.info(
10401040
"Skipping constant folding for ConstantOfShape node %r because it is considered a constant "
@@ -1091,9 +1091,10 @@ def log_large_inputs():
10911091
log_large_inputs()
10921092
return None
10931093
else:
1094+
non_none_inputs = [input for input in node.inputs if input is not None]
10941095
if (node.domain, node.op_type) in self.always_fold_ops and all(
10951096
len(input.consumers()) == 1 or (not is_large)
1096-
for input, is_large in zip(node.inputs, large_inputs)
1097+
for input, is_large in zip(non_none_inputs, large_inputs)
10971098
if input is not None
10981099
):
10991100
# If the op is in always_fold_ops and all large inputs are used only by this node,

0 commit comments

Comments
 (0)