MCPcopy Create free account
hub / github.com/thygate/stable-diffusion-webui-depthmap-script / ResidualConvUnit

Class ResidualConvUnit

dmidas/blocks.py:246–282  ·  view source on GitHub ↗

Residual convolution module.

Source from the content-addressed store, hash-verified

244
245
246class ResidualConvUnit(nn.Module):
247 """Residual convolution module.
248 """
249
250 def __init__(self, features):
251 """Init.
252
253 Args:
254 features (int): number of features
255 """
256 super().__init__()
257
258 self.conv1 = nn.Conv2d(
259 features, features, kernel_size=3, stride=1, padding=1, bias=True
260 )
261
262 self.conv2 = nn.Conv2d(
263 features, features, kernel_size=3, stride=1, padding=1, bias=True
264 )
265
266 self.relu = nn.ReLU(inplace=True)
267
268 def forward(self, x):
269 """Forward pass.
270
271 Args:
272 x (tensor): input
273
274 Returns:
275 tensor: output
276 """
277 out = self.relu(x)
278 out = self.conv1(out)
279 out = self.relu(out)
280 out = self.conv2(out)
281
282 return out + x
283
284
285class FeatureFusionBlock(nn.Module):

Callers 1

__init__Method · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected