Args: tensor (Tensor): Tensor image of size (C, H, W) to be normalized. Returns: Tensor: Normalized image.
(self, tensor)
| 295 | self.std = std |
| 296 | |
| 297 | def __call__(self, tensor): |
| 298 | """ |
| 299 | Args: |
| 300 | tensor (Tensor): Tensor image of size (C, H, W) to be normalized. |
| 301 | Returns: |
| 302 | Tensor: Normalized image. |
| 303 | """ |
| 304 | batch_size = tensor.size(0) |
| 305 | for i in range(batch_size): |
| 306 | for t, m, s in zip(tensor[i], self.mean, self.std): |
| 307 | t.mul_(s).add_(m) |
| 308 | # The normalize code -> t.sub_(m).div_(s) |
| 309 | return tensor |
| 310 | |
| 311 | class L2Loss(nn.Module): |
| 312 | """ |
nothing calls this directly
no outgoing calls
no test coverage detected