MCPcopy Create free account
hub / github.com/google-research/language / __call__

Method __call__

language/mentionmemory/modules/mlp.py:54–69  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected