MCPcopy Create free account
hub / github.com/DragonisCV/RAM / forward

Method forward

ram/utils/diffjpeg.py:160–175  ·  view source on GitHub ↗

Args: image(tensor): batch x height x width Returns: Tensor: batch x height x width

(self, image, factor=1)

Source from the content-addressed store, hash-verified

158 self.y_table = y_table
159
160 def forward(self, image, factor=1):
161 """
162 Args:
163 image(tensor): batch x height x width
164
165 Returns:
166 Tensor: batch x height x width
167 """
168 if isinstance(factor, (int, float)):
169 image = image.float() / (self.y_table * factor)
170 else:
171 b = factor.size(0)
172 table = self.y_table.expand(b, 1, 8, 8) * factor.view(b, 1, 1, 1)
173 image = image.float() / table
174 image = self.rounding(image)
175 return image
176
177
178class CQuantize(nn.Module):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected