Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
b43e3f93
Unverified
Commit
b43e3f93
authored
Apr 30, 2021
by
Frederik Bode
Committed by
GitHub
Apr 30, 2021
Browse files
correct the dimension comment of matrix multiplication (#11494)
Co-authored-by:
Frederik Bode
<
frederik@paperbox.ai
>
parent
f37f2adb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
1 deletion
+1
-1
src/transformers/models/longformer/modeling_longformer.py
src/transformers/models/longformer/modeling_longformer.py
+1
-1
No files found.
src/transformers/models/longformer/modeling_longformer.py
View file @
b43e3f93
...
...
@@ -814,7 +814,7 @@ class LongformerSelfAttention(nn.Module):
# matrix multiplication
# bcxd: batch_size * num_heads x chunks x 2window_overlap x head_dim
# bcyd: batch_size * num_heads x chunks x 2window_overlap x head_dim
# bcxy: batch_size * num_heads x chunks x 2window_overlap x window_overlap
# bcxy: batch_size * num_heads x chunks x 2window_overlap x
2
window_overlap
diagonal_chunked_attention_scores
=
torch
.
einsum
(
"bcxd,bcyd->bcxy"
,
(
query
,
key
))
# multiply
# convert diagonals into columns
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment