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

Method forward

segmentation/backbones/hrnet.py:596–631  ·  view source on GitHub ↗

Forward function.

(self, x)

Source from the content-addressed store, hash-verified

594 param.requires_grad = False
595
596 def forward(self, x):
597 """Forward function."""
598
599 x = self.conv1(x)
600 x = self.norm1(x)
601 x = self.relu(x)
602 x = self.conv2(x)
603 x = self.norm2(x)
604 x = self.relu(x)
605 x = self.layer1(x)
606
607 x_list = []
608 for i in range(self.stage2_cfg['num_branches']):
609 if self.transition1[i] is not None:
610 x_list.append(self.transition1[i](x))
611 else:
612 x_list.append(x)
613 y_list = self.stage2(x_list)
614
615 x_list = []
616 for i in range(self.stage3_cfg['num_branches']):
617 if self.transition2[i] is not None:
618 x_list.append(self.transition2[i](y_list[-1]))
619 else:
620 x_list.append(y_list[i])
621 y_list = self.stage3(x_list)
622
623 x_list = []
624 for i in range(self.stage4_cfg['num_branches']):
625 if self.transition3[i] is not None:
626 x_list.append(self.transition3[i](y_list[-1]))
627 else:
628 x_list.append(y_list[i])
629 y_list = self.stage4(x_list)
630
631 return y_list
632
633 def train(self, mode=True):
634 """Convert the model into training mode will keeping the normalization

Callers

nothing calls this directly

Calls 2

norm1Method · 0.95
norm2Method · 0.95

Tested by

no test coverage detected