@@ -58,7 +58,10 @@ def __init__(self, inp, oup, mid_channels, *, ksize, stride):
5858 M .BatchNorm2d (mid_channels ),
5959 M .ReLU (),
6060 # dw
61- M .Conv2d (mid_channels , mid_channels , ksize , stride , pad , groups = mid_channels , bias = False ,),
61+ M .Conv2d (
62+ mid_channels , mid_channels , ksize , stride , pad ,
63+ groups = mid_channels , bias = False ,
64+ ),
6265 M .BatchNorm2d (mid_channels ),
6366 # pw-linear
6467 M .Conv2d (mid_channels , outputs , 1 , 1 , 0 , bias = False ),
@@ -135,13 +138,15 @@ def __init__(self, num_classes=1000, model_size="1.5x"):
135138 if i == 0 :
136139 self .features .append (
137140 ShuffleV2Block (
138- input_channel , output_channel , mid_channels = output_channel // 2 , ksize = 3 , stride = 2 ,
141+ input_channel , output_channel ,
142+ mid_channels = output_channel // 2 , ksize = 3 , stride = 2 ,
139143 )
140144 )
141145 else :
142146 self .features .append (
143147 ShuffleV2Block (
144- input_channel // 2 , output_channel , mid_channels = output_channel // 2 , ksize = 3 , stride = 1 ,
148+ input_channel // 2 , output_channel ,
149+ mid_channels = output_channel // 2 , ksize = 3 , stride = 1 ,
145150 )
146151 )
147152
@@ -157,7 +162,9 @@ def __init__(self, num_classes=1000, model_size="1.5x"):
157162 self .globalpool = M .AvgPool2d (7 )
158163 if self .model_size == "2.0x" :
159164 self .dropout = M .Dropout (0.2 )
160- self .classifier = M .Sequential (M .Linear (self .stage_out_channels [- 1 ], num_classes , bias = False ))
165+ self .classifier = M .Sequential (
166+ M .Linear (self .stage_out_channels [- 1 ], num_classes , bias = False )
167+ )
161168 self ._initialize_weights ()
162169
163170 def forward (self , x ):
0 commit comments