Mixture-Of-Experts · Problem 1 of 4
Implement top- routing (softmax top- renormalized gates) in PyTorch.
Implement the function/class skeleton in the editor. Any correct approach is accepted.
import torch
import torch.nn as nn
import torch.nn.functional as F
class TopKRouter(nn.Module):
def __init__(self, d_model: int, n_experts: int, k: int):
raise NotImplementedError
def forward(self, x):
raise NotImplementedErrorReady when you are
Submit your solution and a structured review appears here — verdict, score, and concrete feedback. Any correct approach passes.
Implement top- routing (softmax top- renormalized gates) in PyTorch.
Implement the function/class skeleton in the editor. Any correct approach is accepted.