code: def upcast_int8_nfunc(fn):
      """Decorator that upcasts input of dtype int8 to float32.
  
      This is so that floating-point computation is not carried using
      half-precision (float16), as some NumPy functions do.
  
      Parameters
      ----------
      fn
          A function computing a floating-point value from inputs.
  
      Returns
      -------
      A function similar to fn, but upcasting its uint8 and int8 inputs before
      carrying out the computation.
      """
  
      def ret(*args, **kwargs):
          args = list(args)
          for i, a in enumerate(args):
              if getattr(a, "dtype", None) in ("int8", "uint8"):
                  args[i] = a.astype("float32")
  
          return fn(*args, **kwargs)
  
      return ret
  
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 8 for calling a global function with example usage: upcast_int8_nfunc(fn) and returns: ret, fn