(self, dim, num_heads, mlp_ratio=4., qkv_bias=False, qk_scale=None, drop=0., attn_drop=0.,
drop_path=0., act_layer=nn.GELU, norm_layer=nn.LayerNorm)
| 114 | |
| 115 | class CBlock(nn.Module): |
| 116 | def __init__(self, dim, num_heads, mlp_ratio=4., qkv_bias=False, qk_scale=None, drop=0., attn_drop=0., |
| 117 | drop_path=0., act_layer=nn.GELU, norm_layer=nn.LayerNorm): |
| 118 | super().__init__() |
| 119 | self.pos_embed = conv_3x3x3(dim, dim, groups=dim) |
| 120 | self.norm1 = bn_3d(dim) |
| 121 | self.conv1 = conv_1x1x1(dim, dim, 1) |
| 122 | self.conv2 = conv_1x1x1(dim, dim, 1) |
| 123 | self.attn = conv_5x5x5(dim, dim, groups=dim) |
| 124 | # NOTE: drop path for stochastic depth, we shall see if this is better than dropout here |
| 125 | self.drop_path = DropPath(drop_path) if drop_path > 0. else nn.Identity() |
| 126 | self.norm2 = bn_3d(dim) |
| 127 | mlp_hidden_dim = int(dim * mlp_ratio) |
| 128 | self.mlp = CMlp(in_features=dim, hidden_features=mlp_hidden_dim, act_layer=act_layer, drop=drop) |
| 129 | |
| 130 | def forward(self, x): |
| 131 | x = x + self.pos_embed(x) |
nothing calls this directly
no test coverage detected