MCPcopy Create free account
hub / github.com/VisionXLab/OF-Diff / ResidualConvUnit

Class ResidualConvUnit

ldm/modules/midas/midas/blocks.py:155–191  ·  view source on GitHub ↗

Residual convolution module.

Source from the content-addressed store, hash-verified

153
154
155class ResidualConvUnit(nn.Module):
156 """Residual convolution module.
157 """
158
159 def __init__(self, features):
160 """Init.
161
162 Args:
163 features (int): number of features
164 """
165 super().__init__()
166
167 self.conv1 = nn.Conv2d(
168 features, features, kernel_size=3, stride=1, padding=1, bias=True
169 )
170
171 self.conv2 = nn.Conv2d(
172 features, features, kernel_size=3, stride=1, padding=1, bias=True
173 )
174
175 self.relu = nn.ReLU(inplace=True)
176
177 def forward(self, x):
178 """Forward pass.
179
180 Args:
181 x (tensor): input
182
183 Returns:
184 tensor: output
185 """
186 out = self.relu(x)
187 out = self.conv1(out)
188 out = self.relu(out)
189 out = self.conv2(out)
190
191 return out + x
192
193
194class FeatureFusionBlock(nn.Module):

Callers 1

__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected