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
OpenDAS
vision
Commits
5b4f79d9
Unverified
Commit
5b4f79d9
authored
Nov 18, 2022
by
Vladislav Sovrasov
Committed by
GitHub
Nov 18, 2022
Browse files
Don't use named args in MHA calls to allow applying pytorch forward hooks to VIT (#6956)
parent
d710f3d1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
1 deletion
+1
-1
torchvision/models/vision_transformer.py
torchvision/models/vision_transformer.py
+1
-1
No files found.
torchvision/models/vision_transformer.py
View file @
5b4f79d9
...
...
@@ -110,7 +110,7 @@ class EncoderBlock(nn.Module):
def
forward
(
self
,
input
:
torch
.
Tensor
):
torch
.
_assert
(
input
.
dim
()
==
3
,
f
"Expected (batch_size, seq_length, hidden_dim) got
{
input
.
shape
}
"
)
x
=
self
.
ln_1
(
input
)
x
,
_
=
self
.
self_attention
(
query
=
x
,
key
=
x
,
value
=
x
,
need_weights
=
False
)
x
,
_
=
self
.
self_attention
(
x
,
x
,
x
,
need_weights
=
False
)
x
=
self
.
dropout
(
x
)
x
=
x
+
input
...
...
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