提交 8a578a08 编写于 作者: Y Yang Nie 提交者: Tingquan Gao

remove the comma at the end

上级 4962f712
...@@ -251,7 +251,7 @@ class SpatialSepConvSF(nn.Layer): ...@@ -251,7 +251,7 @@ class SpatialSepConvSF(nn.Layer):
groups=oup1, groups=oup1,
bias_attr=False), bias_attr=False),
nn.BatchNorm2D(oup1 * oup2), nn.BatchNorm2D(oup1 * oup2),
ChannelShuffle(oup1), ) ChannelShuffle(oup1))
def forward(self, x): def forward(self, x):
out = self.conv(x) out = self.conv(x)
...@@ -426,7 +426,7 @@ class DYMicroBlock(nn.Layer): ...@@ -426,7 +426,7 @@ class DYMicroBlock(nn.Layer):
expansion=False) if y3 > 0 else nn.Identity(), expansion=False) if y3 > 0 else nn.Identity(),
ChannelShuffle(g2), ChannelShuffle(g2),
ChannelShuffle(oup // 2) ChannelShuffle(oup // 2)
if oup % 2 == 0 and y3 != 0 else nn.Identity(), ) if oup % 2 == 0 and y3 != 0 else nn.Identity())
elif g2 == 0: elif g2 == 0:
self.layers = nn.Sequential( self.layers = nn.Sequential(
GroupConv(inp, hidden_dim2, gs1), GroupConv(inp, hidden_dim2, gs1),
...@@ -439,7 +439,7 @@ class DYMicroBlock(nn.Layer): ...@@ -439,7 +439,7 @@ class DYMicroBlock(nn.Layer):
reduction=act_reduction, reduction=act_reduction,
init_b=[init_ab3[1], 0.0], init_b=[init_ab3[1], 0.0],
g=gs1, g=gs1,
expansion=False) if y3 > 0 else nn.Identity(), ) expansion=False) if y3 > 0 else nn.Identity())
else: else:
self.layers = nn.Sequential( self.layers = nn.Sequential(
GroupConv(inp, hidden_dim2, gs1), GroupConv(inp, hidden_dim2, gs1),
...@@ -465,7 +465,7 @@ class DYMicroBlock(nn.Layer): ...@@ -465,7 +465,7 @@ class DYMicroBlock(nn.Layer):
reduction=act_reduction, reduction=act_reduction,
init_b=init_b, init_b=init_b,
g=gs1, g=gs1,
expansion=True, ) if y2 > 0 else nn.ReLU6(), expansion=True) if y2 > 0 else nn.ReLU6(),
ChannelShuffle(hidden_dim2 // 4) ChannelShuffle(hidden_dim2 // 4)
if y1 != 0 and y2 != 0 else nn.Identity() if y1 != 0 and y2 != 0 else nn.Identity()
if y1 == 0 and y2 == 0 else ChannelShuffle(hidden_dim2 // 2), if y1 == 0 and y2 == 0 else ChannelShuffle(hidden_dim2 // 2),
...@@ -482,7 +482,7 @@ class DYMicroBlock(nn.Layer): ...@@ -482,7 +482,7 @@ class DYMicroBlock(nn.Layer):
g=(g1, g2), g=(g1, g2),
expansion=False) if y3 > 0 else nn.Identity(), expansion=False) if y3 > 0 else nn.Identity(),
ChannelShuffle(g2), ChannelShuffle(g2),
ChannelShuffle(oup // 2) if y3 != 0 else nn.Identity(), ) ChannelShuffle(oup // 2) if y3 != 0 else nn.Identity())
def forward(self, x): def forward(self, x):
out = self.layers(x) out = self.layers(x)
...@@ -521,20 +521,17 @@ class MicroNet(nn.Layer): ...@@ -521,20 +521,17 @@ class MicroNet(nn.Layer):
groups_1x1=(c3, g3, g4), groups_1x1=(c3, g3, g4),
dy=[y1, y2, y3], dy=[y1, y2, y3],
ratio=r, ratio=r,
activation_cfg=activation_cfg, )) activation_cfg=activation_cfg))
input_channel = c input_channel = c
self.features = nn.Sequential(*layers) self.features = nn.Sequential(*layers)
self.avgpool = nn.Sequential( self.avgpool = nn.Sequential(nn.ReLU6(),
nn.ReLU6(), nn.AdaptiveAvgPool2D(1), nn.Hardswish())
nn.AdaptiveAvgPool2D(1),
nn.Hardswish(), )
# building last several layers # building last several layers
self.classifier = nn.Sequential( self.classifier = nn.Sequential(
SwishLinear(input_channel, out_ch), SwishLinear(input_channel, out_ch),
nn.Dropout(dropout_rate), nn.Dropout(dropout_rate), SwishLinear(out_ch, class_num))
SwishLinear(out_ch, class_num), )
self.apply(self._initialize_weights) self.apply(self._initialize_weights)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册