ThatAIguyA world of ideas

THE CONSCIOUSNESS ATLAS
Read. Experiment. Follow the evidence.

ConsciousnessLearn · Explore · Joseph Anady

Sum the selected expert outputs with their routing weights

Each chosen expert evaluates the same input representation h. Its output vector is multiplied by the associated routing weight, and the selected vectors are added. The implementation groups tokens by expert for efficient evaluation and restores their original order…

Donor model implementationhistorical source recovered; expression not executed in this website audit
Learn with the Atlas

Learn to read this model

Start with the symbols, follow the operations, and check what the result means.

Open guided lesson
donor-eq-5abd779cdef42dsource-code mathematical expression
finalout=(newx.view(∗topkids.shape,−1).type(topkweight.dtype).mul(topkweight.unsqueeze(dim=−1)).sum(dim=1).type(newx.dtype))final_out = (new_x.view( *topk_ids.shape, -1).type(topk_weight.dtype).mul_( topk_weight.unsqueeze(dim=-1)).sum(dim=1).type(new_x.dtype))

Read the equation

Each chosen expert evaluates the same input representation h. Its output vector is multiplied by the associated routing weight, and the selected vectors are added. The implementation groups tokens by expert for efficient evaluation and restores their original order before summing; those data-movement steps preserve this intended mixture formula.

Terms & definitions

TermMeaning in this source
h

Token representation

w_i

Routing weight for selected expert i

y

Routed output vector

How it works

Read the definition from its right-hand expression to the quantity on the left. Its surrounding source records the intended input, state, or parameter context. Where the source leaves an operation unspecified, this page preserves that gap.

Assumptions & limits

Source recovery establishes that the expression appears in this record. Its mathematical validity, implementation behavior, and interpretation must be assessed separately. See the linked source and research notes for the checks available for this version.

Original context

Read the surrounding source passage
new_x = torch.empty_like(outs)
        new_x[idxs] = outs
        final_out = (new_x.view(
            *topk_ids.shape, -1).type(topk_weight.dtype).mul_(
                topk_weight.unsqueeze(dim=-1)).sum(dim=1).type(new_x.dtype))
        return final_out
Exact original notation
final_out = (new_x.view(
            *topk_ids.shape, -1).type(topk_weight.dtype).mul_(
                topk_weight.unsqueeze(dim=-1)).sum(dim=1).type(new_x.dtype))

Related builds

Sources & provenance

01
kimi source tree.txt
lines 2932–2934 · Aug 5, 2026
final_out = (new_x.view( *topk_ids.shape, -1).type(topk_weight.dtype).mul_( topk_weight.unsqueeze(dim=-1)).sum(dim=1).type(new_x.dtype))
02
DEEPSEEK_R1_COMPLETE.txt
lines 2711–2717 · Aug 5, 2026
final_out = ( new_x.view(*topk_ids.shape, -1) .type(topk_weight.dtype) .mul_(topk_weight.unsqueeze(dim=-1)) .sum(dim=1) .type(new_x.dtype) )
03
kimi source tree.txt
lines 2932–2934 · Aug 5, 2026
final_out = (new_x.view( *topk_ids.shape, -1).type(topk_weight.dtype).mul_( topk_weight.unsqueeze(dim=-1)).sum(dim=1).type(new_x.dtype))
04
DEEPSEEK_R1_COMPLETE.txt
lines 2711–2717 · Aug 5, 2026
final_out = ( new_x.view(*topk_ids.shape, -1) .type(topk_weight.dtype) .mul_(topk_weight.unsqueeze(dim=-1)) .sum(dim=1) .type(new_x.dtype) )

Search equations, builds, manuscript text, and recovered sources.