code: def check_floatX(inputs, rval):
      """
      Parameters
      ----------
      inputs
          Inputs to a function that returned `rval` with these inputs.
      rval
          Value returned by a function with inputs set to `inputs`.
  
      Returns
      -------
      Either `rval` unchanged, or `rval` cast in float32. The idea is that when a
      numpy function would have returned a float64, PyTensor may prefer to return a
      float32 instead when `config.cast_policy` is set to ``'numpy+floatX'`` and
      `config.floatX` to ``'float32'``, and there was no float64 input.
      """
      if (
          isinstance(rval, np.ndarray)
          and rval.dtype == "float64"
          and config.cast_policy == "numpy+floatX"
          and config.floatX == "float32"
          and all(x.dtype != "float64" for x in inputs)
      ):
          # Then we expect float32 instead of float64.
          return rval.astype("float32")
      else:
          return rval
  
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 21 for calling a global function with example usage: check_floatX(inputs, rval) and returns: rval, rval