You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by "masahi (via GitHub)" <gi...@apache.org> on 2023/05/23 07:00:05 UTC

[GitHub] [tvm] masahi commented on a diff in pull request #14907: [Unity] Support causal mask for `R.nn.attention`

masahi commented on code in PR #14907:
URL: https://github.com/apache/tvm/pull/14907#discussion_r1201634861


##########
python/tvm/relax/op/nn/nn.py:
##########
@@ -1035,13 +1036,32 @@ def attention(
         a 4-D tensor ending with seq_len_kv, and broadcastable to
         (batch_size, num_head, seq_len, seq_len_kv).
 
-    scale: Optional[FloatImm]
-        The custom scale applied before the softmax. The default value is 1 / sqrt(head_dim).
+    causal_mask: Optional[str]
+        The optional causal mask, i.e. 'TopLeft' and 'BottomRight'.
+        For example, with seq_len = 4, seq_len_kv = 2,
+        mask for 'TopLeft':
+        [[1, 0],
+         [1, 1],
+         [1, 1],
+         [1, 1]]
+        mask for 'BottomRight':
+        [[1, 1],
+         [1, 1],
+         [1, 1],
+         [1, 1]]

Review Comment:
   All elements are one. Is this correct?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org