code: def zoom(
      img,
      scale_factor,
      keep_size,
      mode,
      padding_mode,
      align_corners,
      dtype,
      lazy,
      transform_info,
  ):
      """
      Functional implementation of zoom.
      This function operates eagerly or lazily according to
      ``lazy`` (default ``False``).
  
      Args:
          img: data to be changed, assuming `img` is channel-first.
          scale_factor: The zoom factor along the spatial axes.
              If a float, zoom is the same for each spatial axis.
              If a sequence, zoom should contain one value for each spatial axis.
          keep_size: Whether keep original size (padding/slicing if needed).
          mode: {``"bilinear"``, ``"nearest"``}
              Interpolation mode to calculate output values.
              See also: https://pytorch.org/docs/stable/generated/torch.nn.functional.grid_sample.html
          padding_mode: {``"zeros"``, ``"border"``, ``"reflection"``}
              Padding mode for outside grid values.
              See also: https://pytorch.org/docs/stable/generated/torch.nn.functional.grid_sample.html
          align_corners: See also: https://pytorch.org/docs/stable/generated/torch.nn.functional.grid_sample.html
          dtype: data type for resampling computation.
              If None, use the data type of input data. To be compatible with other modules,
              the output data type is always ``float32``.
          lazy: a flag that indicates whether the operation should be performed lazily or not
          transform_info: a dictionary with the relevant information pertaining to an applied transform.
  
      """
      im_shape = (
          img.peek_pending_shape()
          if isinstance(img, MetaTensor)
          else img.shape[1:]
      )
      output_size = [
          int(math.floor(float(i) * z))
          for i, z in zip(im_shape, scale_factor)
      ]
      xform = scale_affine(im_shape, output_size)
      extra_info = {
          "mode": mode,
          "align_corners": align_corners
          if align_corners is not None
          else TraceKeys.NONE,
          "dtype": str(dtype)[
              6:
          ],  # dtype as string; remove "torch": torch.float32 -> float32
          "do_padcrop": False,
          "padcrop": {},
      }
      if keep_size:
          do_pad_crop = not np.allclose(output_size, im_shape)
          if do_pad_crop and lazy:  # update for lazy evaluation
              _pad_crop = ResizeWithPadOrCrop(
                  spatial_size=im_shape, mode=padding_mode
              )
              _pad_crop.lazy = True
              _tmp_img = MetaTensor(
                  [], affine=torch.eye(len(output_size) + 1)
              )
              _tmp_img.push_pending_operation(
                  {
                      LazyAttr.SHAPE: list(output_size),
                      LazyAttr.AFFINE: xform,
                  }
              )
              lazy_cropped = _pad_crop(_tmp_img)
              if isinstance(lazy_cropped, MetaTensor):
                  xform = lazy_cropped.peek_pending_affine()
                  extra_info[
                      "padcrop"
                  ] = lazy_cropped.pending_operations[-1]
              extra_info["do_padcrop"] = do_pad_crop
          output_size = [int(i) for i in im_shape]
      meta_info = TraceableTransform.track_transform_meta(
          img,
          sp_size=output_size,
          affine=xform,
          extra_info=extra_info,
          orig_size=im_shape,
          transform_info=transform_info,
          lazy=lazy,
      )
      out = _maybe_new_metatensor(img)
      if lazy:
          return (
              out.copy_meta_from(meta_info)
              if isinstance(out, MetaTensor)
              else meta_info
          )
      img_t = out.to(dtype)
      _, _m, _, _ = resolves_modes(
          mode, torch_interpolate_spatial_nd=len(img_t.shape) - 1
      )
      zoomed: NdarrayOrTensor = torch.nn.functional.interpolate(
          recompute_scale_factor=True,
          input=img_t.unsqueeze(0),
          scale_factor=list(scale_factor),
          mode=_m,
          align_corners=align_corners,
      ).squeeze(0)
      out, *_ = convert_to_dst_type(
          zoomed, dst=out, dtype=torch.float32
      )
      if isinstance(out, MetaTensor):
          out = out.copy_meta_from(meta_info)
      do_pad_crop = not np.allclose(output_size, zoomed.shape[1:])
      if do_pad_crop:
          _pad_crop = ResizeWithPadOrCrop(
              spatial_size=img_t.shape[1:], mode=padding_mode
          )
          out = _pad_crop(out)
      if get_track_meta() and do_pad_crop:
          padcrop_xform = out.applied_operations.pop()
          out.applied_operations[-1]["extra_info"]["do_padcrop"] = True
          out.applied_operations[-1]["extra_info"][
              "padcrop"
          ] = padcrop_xform
      return out
  
imports: from __future__ import annotations
  import math
  import warnings
  from enum import Enum
  import numpy
  import torch
  import monai
  from monai.config import USE_COMPILED
  from monai.config.type_definitions import NdarrayOrTensor
  from monai.data.meta_obj import get_track_meta
  from monai.data.meta_tensor import MetaTensor
  from monai.data.utils import AFFINE_TOL, compute_shape_offset, to_affine_nd
  from monai.networks.layers import AffineTransform
  from monai.transforms.croppad.array import ResizeWithPadOrCrop
  from monai.transforms.intensity.array import GaussianSmooth
  from monai.transforms.inverse import TraceableTransform
  from monai.transforms.utils import create_rotate, create_translate, resolves_modes, scale_affine
  from monai.transforms.utils_pytorch_numpy_unification import allclose
  from monai.utils import LazyAttr, TraceKeys, convert_to_dst_type, convert_to_numpy, convert_to_tensor, ensure_tuple, ensure_tuple_rep, fall_back_tuple, optional_import
label_desc: Use image node_id 7 for calling a global function with example usage: zoom(img, scale_factor, keep_size, mode, padding_mode, align_corners, dtype, lazy, transform_info) and returns: out, unknown