code: def test_reduce_precision(self):
      arg = np.array(
          [1 + 2**-2 + 2**-4, 128, 256], dtype=np.float32
      )
      expected = np.array(
          [1 + 2**-2, 128, float("Inf")], dtype=np.float32
      )
      exponent_bits = 4
      mantissa_bits = 2
      self._assertOpOutputMatchesExpected(
          lambda x: xla.reduce_precision(
              x, exponent_bits, mantissa_bits
          ),
          args=(arg,),
          expected=expected,
          equality_fn=self.assertAllEqual,
      )
  
      arg = np.array([4], dtype=np.float32)
      expected = np.array([4], dtype=np.float32)
      # Test passing numbers that cannot fit in a 32-bit integer.
      exponent_bits = 2**33
      mantissa_bits = 2**33
      self._assertOpOutputMatchesExpected(
          lambda x: xla.reduce_precision(
              x, exponent_bits, mantissa_bits
          ),
          args=(arg,),
          expected=expected,
          equality_fn=self.assertAllEqual,
      )
  
imports: import functools
  from absl.testing import parameterized
  import numpy
  from tensorflow.compiler.tests import xla_test
  from tensorflow.compiler.tf2xla.ops import gen_xla_ops
  from tensorflow.compiler.tf2xla.python import xla
  from local_xla.xla import xla_data_pb2
  from tensorflow.python.eager import def_function
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import errors
  from tensorflow.python.framework import function
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import tensor_shape
  from tensorflow.python.framework import test_util
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import array_ops_stack
  from tensorflow.python.ops import random_ops_util
  from tensorflow.python.platform import googletest
label_desc: Use image node_id 27 for calling the XlaOpsNumericalTest obj's underlying member method code with example usage: obj.test_reduce_precision() without return types