MCPcopy Create free account
hub / github.com/pytorch/executorch / __init__

Method __init__

backends/mlx/test/test_ops.py:5749–5754  ·  view source on GitHub ↗
(self, num_experts: int, in_features: int, out_features: int)

Source from the content-addressed store, hash-verified

5747 """Model using SwitchLinear for expert selection + matmul."""
5748
5749 def __init__(self, num_experts: int, in_features: int, out_features: int):
5750 super().__init__()
5751 from executorch.backends.mlx.llm.switch import SwitchLinear
5752
5753 self.switch = SwitchLinear(in_features, out_features, num_experts)
5754 self.switch.pack()
5755
5756 def forward(self, x: torch.Tensor, indices: torch.Tensor) -> torch.Tensor:
5757 return self.switch(x, indices)

Callers

nothing calls this directly

Calls 3

SwitchLinearClass · 0.90
packMethod · 0.80
__init__Method · 0.45

Tested by

no test coverage detected