class_docstr: A class to represent an affine transform matrix.
class_docstr_tok: ["A","class","to","represent","an","affine","transform","matrix","."]
docstr: Check if the data is an affine matrix.
docstr_tok: ["Check","if","the","data","is","an","affine","matrix","."]
code: def is_affine_shaped(data):
      """Check if the data is an affine matrix."""
      if isinstance(data, Affine):
          return True
      if isinstance(data, DisplacementField):
          return False
      if not hasattr(data, "shape") or len(data.shape) < 2:
          return False
      return (
          data.shape[-1] in (3, 4) and data.shape[-1] == data.shape[-2]
      )
  
imports: from __future__ import annotations
  import warnings
  import numpy
  import torch
  import monai
  from monai.config import NdarrayOrTensor
  from monai.data.utils import AFFINE_TOL
  from monai.transforms.utils_pytorch_numpy_unification import allclose
  from monai.utils import LazyAttr, convert_to_numpy, convert_to_tensor, look_up_option
label_desc: Use image node_id 2 for calling the Affine obj's underlying member method code with example usage: obj.is_affine_shaped(data) and returns: unknown, True, False, False