From 3a1e019c2bc034ff51a8c7e9b83dcd0338b20319 Mon Sep 17 00:00:00 2001 From: Hiroaki Yamagiwa Date: Sat, 1 Aug 2026 00:26:53 +0900 Subject: [PATCH] Fix dangling sentence and stray parenthesis in SDPA tutorial --- intermediate_source/scaled_dot_product_attention_tutorial.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/intermediate_source/scaled_dot_product_attention_tutorial.py b/intermediate_source/scaled_dot_product_attention_tutorial.py index 35b1ba7be4e..271ba3796fe 100644 --- a/intermediate_source/scaled_dot_product_attention_tutorial.py +++ b/intermediate_source/scaled_dot_product_attention_tutorial.py @@ -374,11 +374,12 @@ def generate_rand_batch( # This only has an impact when the attention scores matrix is not square, which is common for decoding use cases. # Another way of thinking about this concept is that when you use upper left bias, # the 0th token in the query is aligned to the 0th token in the key, while for lower right bias, +# the last token in the query is aligned to the last token in the key. # Assuming the attention score matrix is two dimensional, ``attn_score[0][0]`` is the attention score # between the 0th token in the query and the 0th token in the key. # For lower right bias, the sequence of q is aligned so that the last token in q is aligned to the last token in k -# (for example, ``attn_score[-1][-1])`` is all True since the last token in q is at the same position as the last token in k -# even if the sequence length of q and k are different. +# (for example, ``attn_score[-1][-1]`` is True since the last token in q is at the same position as the last token in k, +# even if the sequence lengths of q and k are different). # These objects are intended to be used with sdpa out_upper_left = F.scaled_dot_product_attention(query, key, value, upper_left_bias)