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
5f8e3999
Unverified
Commit
5f8e3999
authored
Aug 04, 2022
by
Fragile-azalea
Committed by
GitHub
Aug 04, 2022
Browse files
fix GshardGate top1_idx
parent
f2e0d1d5
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 @
5f8e3999
...
@@ -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