MCPcopy Create free account
hub / github.com/ActiveVisionLab/DFNet / __call__

Method __call__

script/feature/misc.py:297–309  ·  view source on GitHub ↗

Args: tensor (Tensor): Tensor image of size (C, H, W) to be normalized. Returns: Tensor: Normalized image.

(self, tensor)

Source from the content-addressed store, hash-verified

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
311class L2Loss(nn.Module):
312 """

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected