Skip to content

Commit 1f422a1

Browse files
committed
Move validation on top (important)
1 parent c8c114a commit 1f422a1

File tree

1 file changed

+9
-9
lines changed
  • segmentation_models_pytorch/decoders/unet

1 file changed

+9
-9
lines changed

segmentation_models_pytorch/decoders/unet/model.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,15 @@ def __init__(
121121
):
122122
super().__init__()
123123

124+
decoder_use_batchnorm = kwargs.pop("decoder_use_batchnorm", None)
125+
if decoder_use_batchnorm is not None:
126+
warnings.warn(
127+
"The usage of decoder_use_batchnorm is deprecated. Please modify your code for decoder_use_norm",
128+
DeprecationWarning,
129+
stacklevel=2,
130+
)
131+
decoder_use_norm = decoder_use_batchnorm
132+
124133
self.encoder = get_encoder(
125134
encoder_name,
126135
in_channels=in_channels,
@@ -131,15 +140,6 @@ def __init__(
131140

132141
add_center_block = encoder_name.startswith("vgg")
133142

134-
decoder_use_batchnorm = kwargs.pop("decoder_use_batchnorm", None)
135-
if decoder_use_batchnorm is not None:
136-
warnings.warn(
137-
"The usage of decoder_use_batchnorm is deprecated. Please modify your code for use_norm",
138-
DeprecationWarning,
139-
stacklevel=2,
140-
)
141-
decoder_use_norm = decoder_use_batchnorm
142-
143143
self.decoder = UnetDecoder(
144144
encoder_channels=self.encoder.out_channels,
145145
decoder_channels=decoder_channels,

0 commit comments

Comments
 (0)