code: def testCondConstPropagation(self):
      with self.session() as sess, self.test_scope():
          xla_context = control_flow_ops.XLAControlFlowContext()
          xla_context.Enter()
  
          x = array_ops.placeholder(dtypes.float32)
          p = array_ops.placeholder(dtypes.int32)
  
          # TODO(b/129021699): Wrapping this in a tf.function does not work.
          def if_true():
              # This emits a StridedSlice op which expects the index to be a
              # compile-time const.
              return x[p]
  
          def if_false():
              return 5.0
  
          output = cond.cond(
              constant_op.constant(True), if_true, if_false
          )
  
          self.assertAllEqual(
              1.0,
              sess.run(output, feed_dict={x: [0.0, 1.0, 2.0], p: 1}),
          )
  
          xla_context.Exit()
  
imports: from tensorflow.compiler.tests import xla_test
  from tensorflow.python.client import session
  from tensorflow.python.compiler.xla import xla
  from tensorflow.python.eager import def_function
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import errors
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import test_util
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import cond
  from tensorflow.python.ops import control_flow_ops
  from tensorflow.python.ops import control_flow_switch_case
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops import random_ops
  from tensorflow.python.ops import tensor_array_ops
  from tensorflow.python.platform import test
label_desc: Use image node_id 4 for calling the CondTest obj's underlying member method code with example usage: obj.testCondConstPropagation() and returns: x, int