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

Class YDequantize

ram/utils/diffjpeg.py:247–269  ·  view source on GitHub ↗

Dequantize Y channel

Source from the content-addressed store, hash-verified

245
246
247class YDequantize(nn.Module):
248 """Dequantize Y channel
249 """
250
251 def __init__(self):
252 super(YDequantize, self).__init__()
253 self.y_table = y_table
254
255 def forward(self, image, factor=1):
256 """
257 Args:
258 image(tensor): batch x height x width
259
260 Returns:
261 Tensor: batch x height x width
262 """
263 if isinstance(factor, (int, float)):
264 out = image * (self.y_table * factor)
265 else:
266 b = factor.size(0)
267 table = self.y_table.expand(b, 1, 8, 8) * factor.view(b, 1, 1, 1)
268 out = image * table
269 return out
270
271
272class CDequantize(nn.Module):

Callers 1

__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected