@@ -131,12 +131,13 @@ def __init__(self, in_dim, out_dim):
131
131
self .bn = layers .SyncBatchNorm (in_dim )
132
132
133
133
self .conv_1x1 = layers .ConvBNReLU (in_dim , out_dim , 1 )
134
+ self .add = layers .Add ()
134
135
self .conv_3x3 = nn .Conv2D (out_dim , out_dim , 3 , 1 , 1 )
135
136
136
137
def forward (self , x ):
137
138
gap = self .gap (x )
138
139
bn = self .bn (gap )
139
- conv1 = self .conv_1x1 (bn ) + x
140
+ conv1 = self .add ( self . conv_1x1 (bn ), x )
140
141
return self .conv_3x3 (conv1 )
141
142
142
143
@@ -152,9 +153,10 @@ def __init__(self, in_dim, out_dim, expand):
152
153
layers .ConvBNReLU (in_dim , in_dim , 3 ),
153
154
layers .DepthwiseConvBN (in_dim , expand_dim , 3 ),
154
155
layers .ConvBN (expand_dim , out_dim , 1 ))
156
+ self .relu = layers .Activation ("relu" )
155
157
156
158
def forward (self , x ):
157
- return F .relu (self .conv (x ) + x )
159
+ return self .relu (self .conv (x ) + x )
158
160
159
161
160
162
class GatherAndExpansionLayer2 (nn .Layer ):
@@ -175,8 +177,10 @@ def __init__(self, in_dim, out_dim, expand):
175
177
layers .DepthwiseConvBN (in_dim , in_dim , 3 , stride = 2 ),
176
178
layers .ConvBN (in_dim , out_dim , 1 ))
177
179
180
+ self .relu = layers .Activation ("relu" )
181
+
178
182
def forward (self , x ):
179
- return F .relu (self .branch_1 (x ) + self .branch_2 (x ))
183
+ return self .relu (self .branch_1 (x ) + self .branch_2 (x ))
180
184
181
185
182
186
class DetailBranch (nn .Layer ):
0 commit comments