Skip to content

Commit

Permalink
Bugfix: Add initializer to model in AttentionMask directly (microsoft…
Browse files Browse the repository at this point in the history
  • Loading branch information
jambayk authored Sep 27, 2023
1 parent 8621bdc commit 1f4a352
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion onnxruntime/python/tools/transformers/fusion_attention.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,15 @@ def process_mask(self, input: str) -> str:
# ReduceSum-13: axes is moved from attribute to input
axes_name = "ort_const_1_reduce_sum_axes"
if self.model.get_initializer(axes_name) is None:
self.add_initializer(name=axes_name, data_type=TensorProto.INT64, dims=[1], vals=[1], raw=False)
self.model.add_initializer(
helper.make_tensor(
name=axes_name,
data_type=TensorProto.INT64,
dims=[1],
vals=[1],
raw=False,
)
)
mask_index_node = helper.make_node(
"ReduceSum",
inputs=[input_name, axes_name],
Expand Down

0 comments on commit 1f4a352

Please sign in to comment.