MCPcopy Create free account
hub / github.com/geekcomputers/Python / __init__

Method __init__

ML/src/python/neuralforge/nn/attention.py:117–123  ·  view source on GitHub ↗
(self, embed_dim, num_heads, num_layers, mlp_ratio=4.0, dropout=0.1)

Source from the content-addressed store, hash-verified

115
116class TransformerEncoder(nn.Module):
117 def __init__(self, embed_dim, num_heads, num_layers, mlp_ratio=4.0, dropout=0.1):
118 super().__init__()
119 self.layers = nn.ModuleList([
120 TransformerBlock(embed_dim, num_heads, mlp_ratio, dropout)
121 for _ in range(num_layers)
122 ])
123 self.norm = nn.LayerNorm(embed_dim)
124
125 def forward(self, x, mask=None):
126 for layer in self.layers:

Callers

nothing calls this directly

Calls 2

TransformerBlockClass · 0.85
__init__Method · 0.45

Tested by

no test coverage detected