code: def resize_image(
      image: Union[np.ndarray, torch.Tensor],
      image_height: Optional[int],
      image_width: Optional[int],
      mode: str = "bilinear",
  ) -> Tuple[torch.Tensor, float, torch.Tensor]:
      if isinstance(image, np.ndarray):
          image = torch.from_numpy(image)
  
      if image_height is None or image_width is None:
          # skip the resizing
          return image, 1.0, torch.ones_like(image[:1])
      # takes numpy array or tensor, returns pytorch tensor
      minscale = min(
          image_height / image.shape[-2],
          image_width / image.shape[-1],
      )
      imre = torch.nn.functional.interpolate(
          image[None],
          scale_factor=minscale,
          mode=mode,
          align_corners=False if mode == "bilinear" else None,
          recompute_scale_factor=True,
      )[0]
      imre_ = torch.zeros(image.shape[0], image_height, image_width)
      imre_[:, 0 : imre.shape[1], 0 : imre.shape[2]] = imre
      mask = torch.zeros(1, image_height, image_width)
      mask[:, 0 : imre.shape[1], 0 : imre.shape[2]] = 1.0
      return imre_, minscale, mask
  
imports: import functools
  import warnings
  from pathlib import Path
  from typing import List, Optional, Tuple, TypeVar, Union
  import numpy
  import torch
  from PIL import Image
  from pytorch3d.io import IO
  from pytorch3d.renderer.cameras import PerspectiveCameras
  from pytorch3d.structures.pointclouds import Pointclouds
label_desc: Use image node_id 12 for calling a global function with example usage: resize_image(image, image_height, image_width, mode) and returns: imre_,  minscale,  mask, image,  int,  torch