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

Method __init__

backends/mlx/llm/switch.py:70–86  ·  view source on GitHub ↗
(
        self,
        input_dims: int,
        output_dims: int,
        num_experts: int,
        bias: bool = False,
    )

Source from the content-addressed store, hash-verified

68 """
69
70 def __init__(
71 self,
72 input_dims: int,
73 output_dims: int,
74 num_experts: int,
75 bias: bool = False,
76 ):
77 super().__init__()
78 self.input_dims = input_dims
79 self.output_dims = output_dims
80 self.num_experts = num_experts
81 self._packed = False
82 self._is_quantized = False
83
84 self.experts = nn.ModuleList(
85 [nn.Linear(input_dims, output_dims, bias=bias) for _ in range(num_experts)]
86 )
87
88 def pack(self):
89 """Stack per-expert weights into 3D buffers and delete the ModuleList.

Callers

nothing calls this directly

Calls 1

__init__Method · 0.45

Tested by

no test coverage detected