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
79f16297
Commit
79f16297
authored
Dec 29, 2020
by
Jiezhong Qiu
Browse files
fix
parent
794c7e54
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
1 deletion
+5
-1
pytorch/cuda/moe.cpp
pytorch/cuda/moe.cpp
+1
-1
pytorch/cuda/moe.py
pytorch/cuda/moe.py
+4
-0
No files found.
pytorch/cuda/moe.cpp
View file @
79f16297
...
@@ -53,7 +53,7 @@ std::vector<torch::Tensor> moe_backward(
...
@@ -53,7 +53,7 @@ std::vector<torch::Tensor> moe_backward(
Wx+b = [W b] [x]
Wx+b = [W b] [x]
[1]
[1]
*/
*/
return
moe_cuda_
for
ward
(
input
,
gate
,
weight
);
return
moe_cuda_
back
ward
(
grad_output
,
input
,
gate
,
weight
);
}
}
...
...
pytorch/cuda/moe.py
View file @
79f16297
...
@@ -49,3 +49,7 @@ input = torch.rand(batch_size, in_feat).cuda()
...
@@ -49,3 +49,7 @@ input = torch.rand(batch_size, in_feat).cuda()
gate
=
torch
.
randint
(
low
=
0
,
high
=
num_expert
,
size
=
(
batch_size
,
)).
int
().
cuda
()
gate
=
torch
.
randint
(
low
=
0
,
high
=
num_expert
,
size
=
(
batch_size
,
)).
int
().
cuda
()
output
=
moe
(
input
,
gate
)
output
=
moe
(
input
,
gate
)
y
=
output
.
mean
()
y
.
backward
()
\ No newline at end of file
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