(tensor: Tensor,
              mean: List[float],
              std: List[float],
              inplace: bool=False)
return tensor
Normalize a float tensor image with mean and standard deviation.
    This transform does not support PIL Image.

    .. note::
        This transform acts out of place by default, i.e., it does not mutates the input tensor.

    See :class:`~torchvision.transforms.Normalize` for more details.

    Args:
        tensor (Tensor): Float tensor image of size (C, H, W) or (B, C, H, W) to be normalized.
        mean (sequence): Sequence of means for each channel.
        std (sequence): Sequence of standard deviations for each channel.
        inplace(bool,optional): Bool to make this operation inplace.

    Returns:
        Tensor: Normalized Tensor image.
Normalize a float tensor image with mean and standard deviation.
    This transform does not support PIL Image.
Normalize a float tensor image with mean and standard deviation . This transform does not support PIL Image .
def normalize(tensor: Tensor,
              mean: List[float],
              std: List[float],
              inplace: bool=False) -> Tensor:
    """Normalize a float tensor image with mean and standard deviation.
    This transform does not support PIL Image.

    .. note::
        This transform acts out of place by default, i.e., it does not mutates the input tensor.

    See :class:`~torchvision.transforms.Normalize` for more details.

    Args:
        tensor (Tensor): Float tensor image of size (C, H, W) or (B, C, H, W) to be normalized.
        mean (sequence): Sequence of means for each channel.
        std (sequence): Sequence of standard deviations for each channel.
        inplace(bool,optional): Bool to make this operation inplace.

    Returns:
        Tensor: Normalized Tensor image.
    """
    if not isinstance(tensor, torch.Tensor):
        raise TypeError('Input tensor should be a torch tensor. Got {}.'.
                        format(type(tensor)))

    if not tensor.is_floating_point():
        raise TypeError('Input tensor should be a float tensor. Got {}.'.
                        format(tensor.dtype))

    if tensor.ndim < 3:
        raise ValueError(
            'Expected tensor to be a tensor image of size (..., C, H, W). Got tensor.size() = '
            '{}.'.format(tensor.size()))

    if not inplace:
        tensor = tensor.clone()

    dtype = tensor.dtype
    mean = torch.as_tensor(mean, dtype=dtype, device=tensor.device)
    std = torch.as_tensor(std, dtype=dtype, device=tensor.device)
    if (std == 0).any():
        raise ValueError(
            'std evaluated to zero after conversion to {}, leading to division by zero.'.
            format(dtype))
    if mean.ndim == 1:
        mean = mean.view(-1, 1, 1)
    if std.ndim == 1:
        std = std.view(-1, 1, 1)
    tensor.sub_(mean).div_(std)
    return tensor
def normalize ( tensor : Tensor , mean : List [ float ] , std : List [ float ] , inplace : bool = False ) -> Tensor : if not isinstance ( tensor , torch . Tensor ) : raise TypeError ( 'Input tensor should be a torch tensor. Got {}.' . format ( type ( tensor ) ) ) if not tensor . is_floating_point ( ) : raise TypeError ( 'Input tensor should be a float tensor. Got {}.' . format ( tensor . dtype ) ) if tensor . ndim < 3 : raise ValueError ( 'Expected tensor to be a tensor image of size (..., C, H, W). Got tensor.size() = ' '{}.' . format ( tensor . size ( ) ) ) if not inplace : tensor = tensor . clone ( ) dtype = tensor . dtype mean = torch . as_tensor ( mean , dtype = dtype , device = tensor . device ) std = torch . as_tensor ( std , dtype = dtype , device = tensor . device ) if ( std == 0 ) . any ( ) : raise ValueError ( 'std evaluated to zero after conversion to {}, leading to division by zero.' . format ( dtype ) ) if mean . ndim == 1 : mean = mean . view ( - 1 , 1 , 1 ) if std . ndim == 1 : std = std . view ( - 1 , 1 , 1 ) tensor . sub_ ( mean ) . div_ ( std ) return tensor