MCPcopy Create free account
hub / github.com/VisionRush/DeepFakeDefenders / __init__

Method __init__

model/convnext.py:26–35  ·  view source on GitHub ↗
(self, dim, drop_path=0., layer_scale_init_value=1e-6)

Source from the content-addressed store, hash-verified

24 layer_scale_init_value (float): Init value for Layer Scale. Default: 1e-6.
25 """
26 def __init__(self, dim, drop_path=0., layer_scale_init_value=1e-6):
27 super().__init__()
28 self.dwconv = nn.Conv2d(dim, dim, kernel_size=7, padding=3, groups=dim) # depthwise conv
29 self.norm = LayerNorm(dim, eps=1e-6)
30 self.pwconv1 = nn.Linear(dim, 4 * dim) # pointwise/1x1 convs, implemented with linear layers
31 self.act = nn.GELU()
32 self.pwconv2 = nn.Linear(4 * dim, dim)
33 self.gamma = nn.Parameter(layer_scale_init_value * torch.ones((dim)),
34 requires_grad=True) if layer_scale_init_value > 0 else None
35 self.drop_path = DropPath(drop_path) if drop_path > 0. else nn.Identity()
36
37 def forward(self, x):
38 input = x

Callers 2

__init__Method · 0.45
__init__Method · 0.45

Calls 1

LayerNormClass · 0.85

Tested by

no test coverage detected