code: def assert_tensor_consistent(self, expected, real):
      from ..lib.sparse import SparseNDArray
  
      np_types = (np.generic, np.ndarray, pd.Timestamp, SparseNDArray)
      if cupy is not None:
          np_types += (cupy.ndarray,)
  
      if isinstance(real, tuple):
          # allow returning a batch of chunks for some operands
          real = real[0]
      if isinstance(real, (str, int, bool, float, complex)):
          real = np.array([real])[0]
      if not isinstance(real, np_types):
          raise AssertionError(
              f"Type of real value ({type(real)}) not one of {np_types!r}"
          )
      if not hasattr(expected, "dtype"):
          return
      if self._check_options["check_dtypes"]:
          try:
              self.assert_dtype_consistent(expected.dtype, real.dtype)
          except AssertionError as ex:
              if hasattr(expected, "op"):
                  raise AssertionError(
                      f"dtype assertion error: {ex}, source operand {expected.op}"
                  )
              else:
                  raise
      if self._check_options["check_shape"]:
          self.assert_shape_consistent(expected.shape, real.shape)
  
imports: import fnmatch
  import functools
  import inspect
  import itertools
  import logging
  import os
  import sys
  import time
  import types
  from typing import Dict
  import numpy
  import pandas
  import pytest
  from ..core.operand import OperandStage
  from ..utils import lazy_import
label_desc: Use image node_id 4 for calling the ObjectCheckMixin obj's underlying member method code with example usage: obj.assert_tensor_consistent(expected, real) without return types