Skip to content

Commit d4e5658

Browse files
committed
avoid name collision
1 parent 5be9d3b commit d4e5658

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

onnxscript/rewriter/rules/common/_fuse_batchnorm.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,9 @@ def rewrite(self, op, x: ir.Value, inbound_out: ir.Value, batchnorm_out: ir.Valu
6868
bias_name = inbound_node.inputs[2].name
6969
else:
7070
original_bias = np.zeros_like(input_mean)
71-
bias_name = x.name + "_bias"
71+
# Use inbound input 1 (should be weight) to derive a name for the bias
72+
# to avoid name collision on initializer creation.
73+
bias_name = inbound_node.inputs[1].name + "_bias"
7274
fused_bias = ir.tensor((original_bias - input_mean) * scale_factor + beta)
7375

7476
return op.op(

0 commit comments

Comments
 (0)