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

Method forward

ML/src/python/neuralforge/nn/attention.py:111–114  ·  view source on GitHub ↗
(self, x, mask=None)

Source from the content-addressed store, hash-verified

109 self.drop_path = DropPath(drop_path) if drop_path > 0.0 else nn.Identity()
110
111 def forward(self, x, mask=None):
112 x = x + self.drop_path(self.attn(self.norm1(x), mask))
113 x = x + self.drop_path(self.mlp(self.norm2(x)))
114 return x
115
116class TransformerEncoder(nn.Module):
117 def __init__(self, embed_dim, num_heads, num_layers, mlp_ratio=4.0, dropout=0.1):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected