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

Method forward

ram/utils/diffjpeg.py:190–205  ·  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

188 self.c_table = c_table
189
190 def forward(self, image, factor=1):
191 """
192 Args:
193 image(tensor): batch x height x width
194
195 Returns:
196 Tensor: batch x height x width
197 """
198 if isinstance(factor, (int, float)):
199 image = image.float() / (self.c_table * factor)
200 else:
201 b = factor.size(0)
202 table = self.c_table.expand(b, 1, 8, 8) * factor.view(b, 1, 1, 1)
203 image = image.float() / table
204 image = self.rounding(image)
205 return image
206
207
208class CompressJpeg(nn.Module):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected