(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:`~paddlevision.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:`~paddlevision.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, paddle.Tensor):
        raise TypeError('Input tensor should be a paddle tensor. Got {}.'.
                        format(type(tensor)))

    if not tensor.dtype in (paddle.float16, paddle.float32, paddle.float64):
        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.shape() = '
            '{}.'.format(tensor.shape))

    if not inplace:
        tensor = tensor.clone()

    dtype = tensor.dtype
    mean = paddle.to_tensor(mean, dtype=dtype, place=tensor.place)
    std = paddle.to_tensor(std, dtype=dtype, place=tensor.place)
    if (std == 0).any():
        raise ValueError('std evaluated to zero, leading to division by zero.')
    if mean.ndim == 1:
        mean = mean.reshape((-1, 1, 1))
    if std.ndim == 1:
        std = std.reshape((-1, 1, 1))
    tensor = tensor.subtract(mean).divide(std)
    return tensor
def normalize ( tensor : Tensor , mean : List [ float ] , std : List [ float ] , inplace : bool = False ) -> Tensor : if not isinstance ( tensor , paddle . Tensor ) : raise TypeError ( 'Input tensor should be a paddle tensor. Got {}.' . format ( type ( tensor ) ) ) if not tensor . dtype in ( paddle . float16 , paddle . float32 , paddle . float64 ) : 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.shape() = ' '{}.' . format ( tensor . shape ) ) if not inplace : tensor = tensor . clone ( ) dtype = tensor . dtype mean = paddle . to_tensor ( mean , dtype = dtype , place = tensor . place ) std = paddle . to_tensor ( std , dtype = dtype , place = tensor . place ) if ( std == 0 ) . any ( ) : raise ValueError ( 'std evaluated to zero, leading to division by zero.' ) if mean . ndim == 1 : mean = mean . reshape ( ( - 1 , 1 , 1 ) ) if std . ndim == 1 : std = std . reshape ( ( - 1 , 1 , 1 ) ) tensor = tensor . subtract ( mean ) . divide ( std ) return tensor