class_docstr: Tests for auto-compilation on CPU/GPU devices.
docstr: Regression test for bug that caused deadlocks in graphs with loops.
docstr_tok: ["Regression","test","for","bug","that","caused","deadlocks","in","graphs","with","loops","."]
code: def testLoopDeadlock(self):
      """Regression test for bug that caused deadlocks in graphs with loops."""
  
      with self.session(config=NoRewriteSessionConfig()) as session:
          x = array_ops.placeholder(dtypes.float32)
          with jit_scope():
              y = x + 1.0
              c = lambda i, _x, _y: math_ops.less(i, 5)
              b = lambda i, x, _y: (i + 1, x * 2.0 + 1.0, x - 3.0)
              _, _, w = while_loop.while_loop(
                  c, b, (constant_op.constant(0), y, x)
              )
              u = w + y
          result = session.run(u, {x: np.float32(2)})
          self.assertAllClose(result, np.float32(63), rtol=1e-1)
  
imports: import os
  import numpy
  from tensorflow.compiler.tests import test_utils
  from tensorflow.core.protobuf import config_pb2
  from tensorflow.core.protobuf import rewriter_config_pb2
  from tensorflow.python.client import session
  from tensorflow.python.compiler.xla import jit
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import function
  from tensorflow.python.framework import ops
  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 gradients_impl
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops import nn_ops
  from tensorflow.python.ops import while_loop
  from tensorflow.python.platform import test
label_desc: Use image node_id 6 for calling the XlaCompilationTest obj's underlying member method code with example usage: obj.testLoopDeadlock() without return types