MCPcopy Create free account
hub / github.com/ml-explore/mlx-examples / __init__

Method __init__

bert/model.py:45–52  ·  view source on GitHub ↗
(
        self, num_layers: int, dims: int, num_heads: int, mlp_dims: Optional[int] = None
    )

Source from the content-addressed store, hash-verified

43
44class TransformerEncoder(nn.Module):
45 def __init__(
46 self, num_layers: int, dims: int, num_heads: int, mlp_dims: Optional[int] = None
47 ):
48 super().__init__()
49 self.layers = [
50 TransformerEncoderLayer(dims, num_heads, mlp_dims)
51 for i in range(num_layers)
52 ]
53
54 def __call__(self, x, mask):
55 for layer in self.layers:

Callers

nothing calls this directly

Calls 2

__init__Method · 0.45

Tested by

no test coverage detected