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

Method forward

segmentation/backbones/hrnet.py:191–214  ·  view source on GitHub ↗

Forward function.

(self, x)

Source from the content-addressed store, hash-verified

189 return nn.ModuleList(fuse_layers)
190
191 def forward(self, x):
192 """Forward function."""
193 if self.num_branches == 1:
194 return [self.branches[0](x[0])]
195
196 for i in range(self.num_branches):
197 x[i] = self.branches[i](x[i])
198
199 x_fuse = []
200 for i in range(len(self.fuse_layers)):
201 y = 0
202 for j in range(self.num_branches):
203 if i == j:
204 y += x[j]
205 elif j > i:
206 y = y + resize(
207 self.fuse_layers[i][j](x[j]),
208 size=x[i].shape[2:],
209 mode='bilinear',
210 align_corners=False)
211 else:
212 y += self.fuse_layers[i][j](x[j])
213 x_fuse.append(self.relu(y))
214 return x_fuse
215
216
217@BACKBONES.register_module()

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected