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

Class Interpolate

ldm/modules/midas/midas/blocks.py:120–152  ·  view source on GitHub ↗

Interpolation module.

Source from the content-addressed store, hash-verified

118
119
120class Interpolate(nn.Module):
121 """Interpolation module.
122 """
123
124 def __init__(self, scale_factor, mode, align_corners=False):
125 """Init.
126
127 Args:
128 scale_factor (float): scaling
129 mode (str): interpolation mode
130 """
131 super(Interpolate, self).__init__()
132
133 self.interp = nn.functional.interpolate
134 self.scale_factor = scale_factor
135 self.mode = mode
136 self.align_corners = align_corners
137
138 def forward(self, x):
139 """Forward pass.
140
141 Args:
142 x (tensor): input
143
144 Returns:
145 tensor: interpolated data
146 """
147
148 x = self.interp(
149 x, scale_factor=self.scale_factor, mode=self.mode, align_corners=self.align_corners
150 )
151
152 return x
153
154
155class ResidualConvUnit(nn.Module):

Callers 3

__init__Method · 0.85
__init__Method · 0.85
__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected