(self, cfg: Config, *, parent: Optional[Module])
| 112 | norm: InstantiableConfig = LayerNorm.default_config() |
| 113 | |
| 114 | def __init__(self, cfg: Config, *, parent: Optional[Module]): |
| 115 | super().__init__(cfg, parent=parent) |
| 116 | cfg = self.config |
| 117 | self._add_child( |
| 118 | "linear", cfg.linear.set(input_dim=cfg.input_dim, output_dim=cfg.output_dim) |
| 119 | ) |
| 120 | self._add_child("norm", cfg.norm.set(input_dim=cfg.output_dim)) |
| 121 | |
| 122 | def forward(self, inputs: Tensor) -> Tensor: |
| 123 | """Applies a non-linear transform to the inputs. |