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
40f5fd36
Unverified
Commit
40f5fd36
authored
Aug 04, 2022
by
Rick Ho
Committed by
GitHub
Aug 04, 2022
Browse files
Merge pull request #130 from Fragile-azalea/master
Fix GshardGate top1_idx
parents
f2e0d1d5
5f8e3999
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
2 deletions
+1
-2
fmoe/gates/gshard_gate.py
fmoe/gates/gshard_gate.py
+1
-2
No files found.
fmoe/gates/gshard_gate.py
View file @
40f5fd36
...
@@ -21,8 +21,7 @@ class GShardGate(NaiveGate):
...
@@ -21,8 +21,7 @@ class GShardGate(NaiveGate):
topk_idx
,
topk_val
,
gate_score
=
naive_outs
topk_idx
,
topk_val
,
gate_score
=
naive_outs
S
=
gate_score
.
shape
[
0
]
S
=
gate_score
.
shape
[
0
]
top_k
=
topk_idx
.
shape
[
0
]
//
gate_score
.
shape
[
0
]
top1_idx
=
topk_idx
.
view
((
-
1
,
self
.
top_k
))[:,
0
]
top1_idx
=
topk_idx
.
view
((
-
1
,
top_k
))[:,
0
]
c_e
=
torch
.
scatter_add
(
c_e
=
torch
.
scatter_add
(
torch
.
zeros
(
self
.
tot_expert
,
device
=
top1_idx
.
device
),
torch
.
zeros
(
self
.
tot_expert
,
device
=
top1_idx
.
device
),
0
,
0
,
...
...
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