MCPcopy Create free account
hub / github.com/NVIDIA/semantic-segmentation / forward

Method forward

network/hrnetv2.py:230–254  ·  view source on GitHub ↗
(self, x)

Source from the content-addressed store, hash-verified

228 return self.num_inchannels
229
230 def forward(self, x):
231 if self.num_branches == 1:
232 return [self.branches[0](x[0])]
233
234 for i in range(self.num_branches):
235 x[i] = self.branches[i](x[i])
236
237 x_fuse = []
238 for i in range(len(self.fuse_layers)):
239 y = x[0] if i == 0 else self.fuse_layers[i][0](x[0])
240 for j in range(1, self.num_branches):
241 if i == j:
242 y = y + x[j]
243 elif j > i:
244 width_output = x[i].shape[-1]
245 height_output = x[i].shape[-2]
246 y = y + F.interpolate(
247 self.fuse_layers[i][j](x[j]),
248 size=[height_output, width_output],
249 mode='bilinear', align_corners=align_corners)
250 else:
251 y = y + self.fuse_layers[i][j](x[j])
252 x_fuse.append(self.relu(y))
253
254 return x_fuse
255
256
257blocks_dict = {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected