MCPcopy Create free account
hub / github.com/apple/axlearn / __init__

Method __init__

axlearn/common/bert.py:219–226  ·  view source on GitHub ↗
(self, cfg: Config, *, parent: Optional[Module])

Source from the content-addressed store, hash-verified

217 output: Linear.Config = Linear.default_config() # Output projection layer.
218
219 def __init__(self, cfg: Config, *, parent: Optional[Module]):
220 super().__init__(cfg, parent=parent)
221 cfg = self.config
222 self._add_child("pooler", cfg.pooler.set(input_dim=cfg.input_dim))
223 self._add_child(
224 "output",
225 cfg.output.set(input_dim=cfg.input_dim, output_dim=cfg.num_classes),
226 )
227
228 def forward(self, input_batch: NestedTensor) -> Tensor:
229 """Produces prediction scores from BERT output features.

Callers

nothing calls this directly

Calls 3

_add_childMethod · 0.80
__init__Method · 0.45
setMethod · 0.45

Tested by

no test coverage detected