code: def rescale(
      image: np.ndarray,
      scale: float,
      data_format: Optional[ChannelDimension] = None,
      dtype: np.dtype = np.float32,
      input_data_format: Optional[Union[str, ChannelDimension]] = None,
  ) -> np.ndarray:
      """
      Rescales `image` by `scale`.
  
      Args:
          image (`np.ndarray`):
              The image to rescale.
          scale (`float`):
              The scale to use for rescaling the image.
          data_format (`ChannelDimension`, *optional*):
              The channel dimension format of the image. If not provided, it will be the same as the input image.
          dtype (`np.dtype`, *optional*, defaults to `np.float32`):
              The dtype of the output image. Defaults to `np.float32`. Used for backwards compatibility with feature
              extractors.
          input_data_format (`ChannelDimension`, *optional*):
              The channel dimension format of the input image. If not provided, it will be inferred from the input image.
  
      Returns:
          `np.ndarray`: The rescaled image.
      """
      if not isinstance(image, np.ndarray):
          raise ValueError(
              f"Input image must be of type np.ndarray, got {type(image)}"
          )
  
      rescaled_image = image * scale
      if data_format is not None:
          rescaled_image = to_channel_dimension_format(
              rescaled_image, data_format, input_data_format
          )
  
      rescaled_image = rescaled_image.astype(dtype)
  
      return rescaled_image
  
imports: import warnings
  from typing import Iterable, List, Optional, Tuple, Union
  import numpy
  from .image_utils import ChannelDimension, ImageInput, get_channel_dimension_axis, get_image_size, infer_channel_dimension_format
  from .utils import ExplicitEnum, TensorType, is_jax_tensor, is_tf_tensor, is_torch_tensor
  from .utils.import_utils import is_flax_available, is_tf_available, is_torch_available, is_vision_available, requires_backends
label_desc: Use image node_id 2 for calling a global function with example usage: rescale(image, scale, data_format, dtype, input_data_format) and returns: rescaled_image