|
19 | 19 |
|
20 | 20 | from timm.data import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD |
21 | 21 | from .helpers import named_apply, build_model_with_cfg, checkpoint_seq |
22 | | -from .layers import trunc_normal_, SelectAdaptivePool2d, DropPath, ConvMlp, Mlp, LayerNorm2d,\ |
| 22 | +from .layers import trunc_normal_, SelectAdaptivePool2d, DropPath, ConvMlp, Mlp, LayerNorm2d, LayerNorm, \ |
23 | 23 | create_conv2d, get_act_layer, make_divisible, to_ntuple |
24 | 24 | from .registry import register_model |
25 | 25 |
|
@@ -161,7 +161,7 @@ def __init__( |
161 | 161 | out_chs = out_chs or in_chs |
162 | 162 | act_layer = get_act_layer(act_layer) |
163 | 163 | if not norm_layer: |
164 | | - norm_layer = partial(LayerNorm2d, eps=1e-6) if conv_mlp else partial(nn.LayerNorm, eps=1e-6) |
| 164 | + norm_layer = LayerNorm2d if conv_mlp else LayerNorm |
165 | 165 | mlp_layer = ConvMlp if conv_mlp else Mlp |
166 | 166 | self.use_conv_mlp = conv_mlp |
167 | 167 |
|
@@ -291,8 +291,8 @@ def __init__( |
291 | 291 | assert output_stride in (8, 16, 32) |
292 | 292 | kernel_sizes = to_ntuple(4)(kernel_sizes) |
293 | 293 | if norm_layer is None: |
294 | | - norm_layer = partial(LayerNorm2d, eps=1e-6) |
295 | | - norm_layer_cl = norm_layer if conv_mlp else partial(nn.LayerNorm, eps=1e-6) |
| 294 | + norm_layer = LayerNorm2d |
| 295 | + norm_layer_cl = norm_layer if conv_mlp else LayerNorm |
296 | 296 | else: |
297 | 297 | assert conv_mlp,\ |
298 | 298 | 'If a norm_layer is specified, conv MLP must be used so all norm expect rank-4, channels-first input' |
|
0 commit comments