MCPcopy Create free account
hub / github.com/alinlab/SelfPatch / forward

Method forward

segmentation/backbones/cgnet.py:335–362  ·  view source on GitHub ↗
(self, x)

Source from the content-addressed store, hash-verified

333 nn.PReLU(cur_channels))
334
335 def forward(self, x):
336 output = []
337
338 # stage 0
339 inp_2x = self.inject_2x(x)
340 inp_4x = self.inject_4x(x)
341 for layer in self.stem:
342 x = layer(x)
343 x = self.norm_prelu_0(torch.cat([x, inp_2x], 1))
344 output.append(x)
345
346 # stage 1
347 for i, layer in enumerate(self.level1):
348 x = layer(x)
349 if i == 0:
350 down1 = x
351 x = self.norm_prelu_1(torch.cat([x, down1, inp_4x], 1))
352 output.append(x)
353
354 # stage 2
355 for i, layer in enumerate(self.level2):
356 x = layer(x)
357 if i == 0:
358 down2 = x
359 x = self.norm_prelu_2(torch.cat([down2, x], 1))
360 output.append(x)
361
362 return output
363
364 def train(self, mode=True):
365 """Convert the model into training mode will keeping the normalization

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected