Skip to content

Commit 1503b68

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

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

onnxscript/optimizer/_constant_folding.py

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

1063-
input_tensors = [x.const_value for x in node.inputs if x is not None]
1063+
input_tensors = [x.const_value if x is not None else None for x in node.inputs]
10641064
large_inputs = [
10651065
tensor is not None and tensor.size > self.input_size_limit
10661066
for tensor in input_tensors
@@ -1091,10 +1091,9 @@ 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]
10951094
if (node.domain, node.op_type) in self.always_fold_ops and all(
10961095
len(input.consumers()) == 1 or (not is_large)
1097-
for input, is_large in zip(non_none_inputs, large_inputs)
1096+
for input, is_large in zip(node.inputs, large_inputs)
10981097
if input is not None
10991098
):
11001099
# If the op is in always_fold_ops and all large inputs are used only by this node,

0 commit comments

Comments
 (0)