Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion onnxscript/function_libs/torch_lib/ops/nn.py
Original file line number Diff line number Diff line change
Expand Up @@ -2078,7 +2078,7 @@ def _aten_scaled_dot_product_attention_bool_mask_onnx(
key_transposed_scaled = op.Mul(key_transposed, op.Sqrt(scale))
# Turn the Boolean mask to float: attn_mask.masked_fill(not attn_mask, -float('inf'))
zero = op.Constant(value=ir.tensor(0.0, dtype=query.dtype))
neg_inf = op.Constant(value=ir.tensor(-float("inf"), dtype=query.dtype))
neg_inf = op.Constant(value=ir.tensor(query.dtype.min), dtype=query.dtype)
attn_mask = op.Where(attn_mask, zero, neg_inf)
attn_weight = op.Softmax(
op.Add(op.MatMul(query_scaled, key_transposed_scaled), attn_mask),
Expand Down