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

Class MLP

clip/model.py:137–148  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

135
136
137class MLP(nn.Module):
138 def __init__(self, config: CLIPTextConfig):
139 super().__init__()
140 self.config = config
141 self.activation_fn = quick_gelu
142 self.fc1 = nn.Linear(config.hidden_size, config.intermediate_size)
143 self.fc2 = nn.Linear(config.intermediate_size, config.hidden_size)
144
145 def __call__(self, x: mx.array) -> mx.array:
146 x = self.activation_fn(self.fc1(x))
147 x = self.fc2(x)
148 return x
149
150
151class EncoderLayer(nn.Module):

Callers 1

__init__Method · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected