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

Class CDequantize

ram/utils/diffjpeg.py:272–294  ·  view source on GitHub ↗

Dequantize CbCr channel

Source from the content-addressed store, hash-verified

270
271
272class CDequantize(nn.Module):
273 """Dequantize CbCr channel
274 """
275
276 def __init__(self):
277 super(CDequantize, self).__init__()
278 self.c_table = c_table
279
280 def forward(self, image, factor=1):
281 """
282 Args:
283 image(tensor): batch x height x width
284
285 Returns:
286 Tensor: batch x height x width
287 """
288 if isinstance(factor, (int, float)):
289 out = image * (self.c_table * factor)
290 else:
291 b = factor.size(0)
292 table = self.c_table.expand(b, 1, 8, 8) * factor.view(b, 1, 1, 1)
293 out = image * table
294 return out
295
296
297class iDCT8x8(nn.Module):

Callers 1

__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected