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
FastMoE
Commits
7945bce6
Commit
7945bce6
authored
Jan 03, 2021
by
Jiezhong Qiu
Browse files
fix bug
parent
85306aa7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
1 deletion
+1
-1
pytorch/mem_transformer.py
pytorch/mem_transformer.py
+1
-1
No files found.
pytorch/mem_transformer.py
View file @
7945bce6
...
@@ -87,7 +87,7 @@ class CustomizedMoEPositionwiseFF(nn.Module):
...
@@ -87,7 +87,7 @@ class CustomizedMoEPositionwiseFF(nn.Module):
# x = F.pad(x, pad=(0, 1), mode='constant', value=1.0)
# x = F.pad(x, pad=(0, 1), mode='constant', value=1.0)
x
=
self
.
moe2
(
x
,
gate_idx
)
x
=
self
.
moe2
(
x
,
gate_idx
)
x
=
self
.
dropout
(
x
)
# (BxL) x d_model
x
=
self
.
dropout
(
x
)
# (BxL) x d_model
outp
ut
.
append
(
x
.
unsqueeze
(
1
))
# (BxL) x 1 x d_model
core_o
ut
.
append
(
x
.
unsqueeze
(
1
))
# (BxL) x 1 x d_model
core_out
=
torch
.
cat
(
core_out
,
dim
=
1
)
# (BxL) x top_k x d_model
core_out
=
torch
.
cat
(
core_out
,
dim
=
1
)
# (BxL) x top_k x d_model
core_out
=
torch
.
bmm
(
gate_score
,
core_out
)
# (BxL) x 1 x d_model
core_out
=
torch
.
bmm
(
gate_score
,
core_out
)
# (BxL) x 1 x d_model
...
...
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