code: def multi_dtype_cast_checks(shape, dtypes=ALL_DTYPES, nameprefix=""):
      for dtype1, dtype2 in combinations(dtypes, 2):
          name1 = f"{nameprefix}_{dtype1}_{dtype2}"
          name2 = f"{nameprefix}_{dtype2}_{dtype1}"
          obj1 = random_of_dtype(shape, dtype1)
          obj2 = random_of_dtype(shape, dtype2)
          yield (name1, (obj1, dtype2))
          yield (name2, (obj2, dtype1))
  
imports: import os
  from copy import copy
  from itertools import combinations
  from tempfile import mkstemp
  import numpy
  import pytest
  import pytensor
  from pytensor import function, shared
  from pytensor.compile.mode import get_default_mode
  from pytensor.configdefaults import config
  from pytensor.graph.utils import MethodNotDefined
  from pytensor.misc.safe_asarray import _asarray
  from pytensor.tensor.type import TensorType, complex_dtypes, discrete_dtypes, float_dtypes
  from tests import unittest_tools
label_desc: Use image node_id 2 for calling a global function with example usage: multi_dtype_cast_checks(shape, dtypes, nameprefix) without return types