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

Method __init__

ML/src/python/neuralforge/nn/attention.py:77–90  ·  view source on GitHub ↗
(self, embed_dim, hidden_dim, dropout=0.1, activation='gelu')

Source from the content-addressed store, hash-verified

75
76class FeedForward(nn.Module):
77 def __init__(self, embed_dim, hidden_dim, dropout=0.1, activation='gelu'):
78 super().__init__()
79 self.fc1 = nn.Linear(embed_dim, hidden_dim)
80 self.fc2 = nn.Linear(hidden_dim, embed_dim)
81 self.dropout = nn.Dropout(dropout)
82
83 if activation == 'gelu':
84 self.activation = nn.GELU()
85 elif activation == 'relu':
86 self.activation = nn.ReLU()
87 elif activation == 'silu':
88 self.activation = nn.SiLU()
89 else:
90 self.activation = nn.GELU()
91
92 def forward(self, x):
93 x = self.fc1(x)

Callers 7

__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected