Args: image(tensor): batch x height x width Returns: Tensor: batch x height x width
(self, image, factor=1)
| 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 | |
| 208 | class CompressJpeg(nn.Module): |
nothing calls this directly
no outgoing calls
no test coverage detected