MCPcopy Create free account
hub / github.com/buaacxf/VIPTR / __init__

Method __init__

modules/VIPTRv1.py:269–289  ·  view source on GitHub ↗
(
            self,
            embed_dim,
            ffn_dim,
            activation_fn=F.gelu,
            dropout=0.0,
            activation_dropout=0.0,
            layernorm_eps=1e-6,
            subln=False,
            subconv=False
    )

Source from the content-addressed store, hash-verified

267
268class FeedForwardNetwork(nn.Module):
269 def __init__(
270 self,
271 embed_dim,
272 ffn_dim,
273 activation_fn=F.gelu,
274 dropout=0.0,
275 activation_dropout=0.0,
276 layernorm_eps=1e-6,
277 subln=False,
278 subconv=False
279 ):
280 super().__init__()
281 self.embed_dim = embed_dim
282 # self.out_dim = out_dim
283 self.activation_fn = activation_fn
284 self.activation_dropout_module = torch.nn.Dropout(activation_dropout)
285 self.dropout_module = torch.nn.Dropout(dropout)
286 self.fc1 = nn.Linear(self.embed_dim, ffn_dim)
287 self.fc2 = nn.Linear(ffn_dim, self.embed_dim)
288 self.ffn_layernorm = nn.LayerNorm(ffn_dim, eps=layernorm_eps) if subln else None
289 self.dwconv = DWConv2d(ffn_dim, 3, 1, 1) if subconv else None
290
291 def reset_parameters(self):
292 self.fc1.reset_parameters()

Callers

nothing calls this directly

Calls 2

DWConv2dClass · 0.70
__init__Method · 0.45

Tested by

no test coverage detected