src/transformers/models/efficientnet/image_processing_efficientnet.py/EfficientNetImageProcessor/rescale
class EfficientNetImageProcessor:    def rescale(
        self,
        image: np.ndarray,
        scale: Union[int, float],
        offset: bool = True,
        data_format: Optional[Union[str, ChannelDimension]] = None,
        **kwargs,
    ):
        """
        Rescale an image by a scale factor. image = image * scale.

        Args:
            image (`np.ndarray`):
                Image to rescale.
            scale (`int` or `float`):
                Scale to apply to the image.
            offset (`bool`, *optional*):
                Whether to scale the image in both negative and positive directions.
            data_format (`str` or `ChannelDimension`, *optional*):
                The channel dimension format of the image. If not provided, it will be the same as the input image.
        """
        if offset:
            rescaled_image = (image - 127.5) * scale
            if data_format is not None:
                rescaled_image = to_channel_dimension_format(rescaled_image, data_format)
            rescaled_image = rescaled_image.astype(np.float32)
        else:
            rescaled_image = rescale(image, scale=scale, data_format=data_format, **kwargs)
        return rescaled_image