class_docstr: Test cases for stochastic cast operator.
class_docstr_tok: ["Test","cases","for","stochastic","cast","operator","."]
code: def testStochasticCastOpSaturateOutOfRange(
      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, [])
          op = stochastic_cast_op.stochastic_cast(
              input_t, to_dtype, [12345, 12345], "auto_select"
          )
          result = sess.run(op)
          self.assertEqual(
              result, _return_saturate_value(value < 0, to_dtype)
          )
  
file_path: tensorflow/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 2 for calling the StochasticCastOpTest obj's underlying member method code with example usage: obj.testStochasticCastOpSaturateOutOfRange(value, from_dtype, to_dtype) without return types