code: def to_norm_affine(
      affine: torch.Tensor,
      src_size: Sequence[int],
      dst_size: Sequence[int],
      align_corners: bool = False,
      zero_centered: bool = False,
  ) -> torch.Tensor:
      """
      Given ``affine`` defined for coordinates in the pixel space, compute the corresponding affine
      for the normalized coordinates.
  
      Args:
          affine: Nxdxd batched square matrix
          src_size: source image spatial shape
          dst_size: target image spatial shape
          align_corners: if True, consider -1 and 1 to refer to the centers of the
              corner pixels rather than the image corners.
              See also: https://pytorch.org/docs/stable/nn.functional.html#torch.nn.functional.grid_sample
          zero_centered: whether the coordinates are normalized from a zero-centered range, default to `False`.
              See also: :py:func:`monai.networks.utils.normalize_transform`.
  
      Raises:
          TypeError: When ``affine`` is not a ``torch.Tensor``.
          ValueError: When ``affine`` is not Nxdxd.
          ValueError: When ``src_size`` or ``dst_size`` dimensions differ from ``affine``.
  
      """
      if not isinstance(affine, torch.Tensor):
          raise TypeError(
              f"affine must be a torch.Tensor but is {type(affine).__name__}."
          )
      if affine.ndimension() != 3 or affine.shape[1] != affine.shape[2]:
          raise ValueError(
              f"affine must be Nxdxd, got {tuple(affine.shape)}."
          )
      sr = affine.shape[1] - 1
      if sr != len(src_size) or sr != len(dst_size):
          raise ValueError(
              f"affine suggests {sr}D, got src={len(src_size)}D, dst={len(dst_size)}D."
          )
  
      src_xform = normalize_transform(
          src_size,
          affine.device,
          affine.dtype,
          align_corners,
          zero_centered,
      )
      dst_xform = normalize_transform(
          dst_size, "cpu", affine.dtype, align_corners, zero_centered
      )
      return (
          src_xform
          @ affine
          @ convert_to_dst_type(
              np.linalg.inv(dst_xform.numpy()), dst=affine
          )[0]
      )
  
imports: from __future__ import annotations
  import io
  import re
  import warnings
  from collections import OrderedDict
  from collections.abc import Callable, Mapping, Sequence
  from contextlib import contextmanager
  from copy import deepcopy
  from typing import Any
  import numpy
  import torch
  import torch.nn
  from monai.apps.utils import get_logger
  from monai.config import PathLike
  from monai.utils.misc import ensure_tuple, save_obj, set_determinism
  from monai.utils.module import look_up_option, optional_import, pytorch_after
  from monai.utils.type_conversion import convert_to_dst_type, convert_to_tensor
label_desc: Use image node_id 7 for calling a global function with example usage: to_norm_affine(affine, src_size, dst_size, align_corners, zero_centered) and returns: unknown