code: def _testMaxItersSimple(self):
      if is_compile_on_demand():
          self.skipTest("list_ops are not supported in cpu_ondemand")
      with self.session() as sess, self.test_scope():
          xla_context = control_flow_ops.XLAControlFlowContext()
          xla_context.Enter()
          v = constant_op.constant(1.0)
          p = array_ops.placeholder(dtype=dtypes.int32)
  
          def create_while_loop():
              iterations = array_ops.size(p, name="iterations")
              r = while_loop.while_loop(
                  lambda *_: True,
                  lambda i, x: (i + 1, v * x),
                  (0, 1.0),
                  maximum_iterations=iterations,
                  name="outer",
              )
              return array_ops.identity(r[1])
  
          output = create_while_loop()
          output = gradients_impl.gradients(output, v)[0]
  
          result = sess.run(output, feed_dict={p: [0, 0, 0]})
          print(result)
          xla_context.Exit()
  
imports: import os
  import numpy
  from tensorflow.compiler.tests import xla_test
  from tensorflow.compiler.tf2xla.python import xla
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import function
  from tensorflow.python.framework import test_util
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import control_flow_ops
  from tensorflow.python.ops import gradients_impl
  from tensorflow.python.ops import map_fn
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops import while_loop
  from tensorflow.python.platform import test
label_desc: Use image node_id 5 for calling the WhileTest obj's underlying member method code with example usage: obj._testMaxItersSimple() and returns: array_ops