MCPcopy Create free account
hub / github.com/ActiveVisionLab/DFNet / forward

Method forward

script/feature/model.py:180–212  ·  view source on GitHub ↗
(self, x)

Source from the content-addressed store, hash-verified

178 nn.Sigmoid() # BCELoss
179 )
180 def forward(self, x):
181 # pdb.set_trace()
182 feat = []
183 feat_out = []
184 for i in range(len(self.encoder)):
185 # print("layer {} encoder layer: {}".format(i, self.encoder[i]))
186 x = self.encoder[i](x)
187 if i == 35: # ReLU-36
188 feat.append(x)
189 elif i == 17: # ReLU-17
190 feat.append(x)
191 elif i == 3: # ReLU-4
192 feat.append(x)
193
194 for i in range(len(self.decoder)):
195 # print("layer {} decoder layer: {}".format(i, self.decoder[i]))
196 x = self.decoder[i](x)
197 if i == 1:
198 _, _, h, w = feat[2].shape
199 x = nn.UpsamplingBilinear2d(size=(h,w))(x)
200 x = x + feat[2]
201 feat_out.append(x)
202 elif i == 3:
203 _, _, h, w = feat[1].shape
204 x = nn.UpsamplingBilinear2d(size=(h,w))(x)
205 x = x + feat[1]
206 feat_out.append(x)
207 elif i == 5:
208 _, _, h, w = feat[0].shape
209 x = nn.UpsamplingBilinear2d(size=(h,w))(x)
210 x = x + feat[0]
211 feat_out.append(x)
212 return feat_out, x
213
214class autoencoder_vgg5(nn.Module): # 36.78 PSNR
215 ''' vgg encoder with bilinear upsampling'''

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected