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

Method forward

segmentation/backbones/resnet.py:267–307  ·  view source on GitHub ↗

Forward function.

(self, x)

Source from the content-addressed store, hash-verified

265 return getattr(self, self.norm3_name)
266
267 def forward(self, x):
268 """Forward function."""
269
270 def _inner_forward(x):
271 identity = x
272
273 out = self.conv1(x)
274 out = self.norm1(out)
275 out = self.relu(out)
276
277 if self.with_plugins:
278 out = self.forward_plugin(out, self.after_conv1_plugin_names)
279
280 out = self.conv2(out)
281 out = self.norm2(out)
282 out = self.relu(out)
283
284 if self.with_plugins:
285 out = self.forward_plugin(out, self.after_conv2_plugin_names)
286
287 out = self.conv3(out)
288 out = self.norm3(out)
289
290 if self.with_plugins:
291 out = self.forward_plugin(out, self.after_conv3_plugin_names)
292
293 if self.downsample is not None:
294 identity = self.downsample(x)
295
296 out += identity
297
298 return out
299
300 if self.with_cp and x.requires_grad:
301 out = cp.checkpoint(_inner_forward, x)
302 else:
303 out = _inner_forward(x)
304
305 out = self.relu(out)
306
307 return out
308
309
310@BACKBONES.register_module()

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected