class_docstr: Test cases for stochastic cast operator.
code: def testStochasticCastOpResultProbability(
      self, value, from_dtype, to_dtype
  ):
      test_value = value
      with self.session() as sess, self.test_scope():
          input_t = constant_op.constant(
              test_value, from_dtype, [1000, 1000]
          )
          op = stochastic_cast_op.stochastic_cast(
              input_t, to_dtype, [12345, 12345], "auto_select"
          )
          result = sess.run(op)
          expected = (test_value - math.floor(test_value)) / (
              math.ceil(test_value) - test_value
          )
          actual = (result == math.ceil(test_value)).sum() / (
              result == math.floor(test_value)
          ).sum()
          self.assertNear(expected, actual, 0.05)
  
file_path: tensorflow-upstream/tensorflow/compiler/tests/stochastic_cast_op_test.py
imports: import math
  from absl.testing import parameterized
  from tensorflow.compiler.tests import xla_test
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import dtypes
  from tensorflow.python.ops import stochastic_cast_op
  from tensorflow.python.platform import test
label_desc: Use image node_id 1 for calling the StochasticCastOpTest obj's underlying member method code with example usage: obj.testStochasticCastOpResultProbability(value, from_dtype, to_dtype) without return types