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

Method __call__

bert/model.py:32–41  ·  view source on GitHub ↗
(self, x, mask)

Source from the content-addressed store, hash-verified

30 self.gelu = nn.GELU()
31
32 def __call__(self, x, mask):
33 attention_out = self.attention(x, x, x, mask)
34 add_and_norm = self.ln1(x + attention_out)
35
36 ff = self.linear1(add_and_norm)
37 ff_gelu = self.gelu(ff)
38 ff_out = self.linear2(ff_gelu)
39 x = self.ln2(ff_out + add_and_norm)
40
41 return x
42
43
44class TransformerEncoder(nn.Module):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected