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

Method __init__

t5/t5.py:224–230  ·  view source on GitHub ↗
(self, config)

Source from the content-addressed store, hash-verified

222
223class TransformerEncoder(nn.Module):
224 def __init__(self, config):
225 super().__init__()
226 self.layers = [
227 TransformerEncoderLayer(config) for i in range(config.num_layers)
228 ]
229 self.ln = nn.RMSNorm(config.d_model, eps=config.layer_norm_epsilon)
230 self.relative_attention_bias = RelativePositionBias(config, bidirectional=True)
231
232 def __call__(self, x: mx.array):
233 pos_bias = self.relative_attention_bias(x.shape[1], x.shape[1])

Callers

nothing calls this directly

Calls 3

__init__Method · 0.45

Tested by

no test coverage detected