code: def testDeadlock(self):
      # Builds a graph of the form:
      #  x -> y
      #       | \
      #       z -> w
      # where x and z are placed on the CPU and y and w are placed on the XLA
      # device. If y and w are clustered for compilation, then the graph will
      # deadlock since the clustered graph will contain a self-loop.
      with self.session() as sess:
          with ops.device(CPU_DEVICE):
              x = array_ops.placeholder(dtypes.float32, [2])
          with self.test_scope():
              y = x * 2
          with ops.device(CPU_DEVICE):
              z = y * y
          with self.test_scope():
              w = y + z
          result = sess.run(w, {x: [1.5, 0.5]})
      self.assertAllClose(result, [12.0, 2.0], rtol=1e-3)
  
file_path: tensorflow/tensorflow/compiler/tests/clustering_test.py
imports: import numpy
  from tensorflow.compiler.tests import xla_test
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import ops
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import math_ops
  from tensorflow.python.platform import googletest
label_desc: Use image node_id 3 for calling the ClusteringTest obj's underlying member method code with example usage: obj.testDeadlock() without return types