Applies MLP block update. Args: x: [..., input_dim]. deterministic: don't apply dropout if true. Returns: Updated array x of same shape.
(self, x: Array, deterministic: bool)
| 52 | self.layer_norm = nn.LayerNorm(epsilon=self.layer_norm_epsilon) |
| 53 | |
| 54 | def __call__(self, x: Array, deterministic: bool) -> Array: |
| 55 | """Applies MLP block update. |
| 56 | |
| 57 | Args: |
| 58 | x: [..., input_dim]. |
| 59 | deterministic: don't apply dropout if true. |
| 60 | |
| 61 | Returns: |
| 62 | Updated array x of same shape. |
| 63 | """ |
| 64 | update = nn.gelu(self.mlp(x)) |
| 65 | update = self.dense(update) |
| 66 | update = self.dropout(update, deterministic=deterministic) |
| 67 | x = self.layer_norm(x + update) |
| 68 | |
| 69 | return x |
nothing calls this directly
no outgoing calls
no test coverage detected