docstr: Side effect ops are added with the same control flow context.
docstr_tok: ["Side","effect","ops","are","added","with","the","same","control","flow","context","."]
code: def test_subscribe_tensors_within_control_flow_context(self):
      """Side effect ops are added with the same control flow context."""
      c1 = constant_op.constant(10)
      c2 = constant_op.constant(20)
      x1 = math_ops.add(c1, c2)
      x2 = math_ops.multiply(c1, c2)
  
      cond = tf_cond.cond(
          x1 < x2,
          lambda: math_ops.add(c1, c2, name="then"),
          lambda: math_ops.subtract(c1, c2, name="else"),
          name="cond",
      )
  
      branch = ops.get_default_graph().get_tensor_by_name("cond/then:0")
  
      def context(tensor):
          return tensor.op._get_control_flow_context()
  
      self.assertIs(context(x1), context(x2))
      self.assertIsNot(context(x1), context(branch))
  
      results = []
  
      def sub(tensor):
          results.append(tensor)
          return tensor
  
      tensors = [x1, branch, x2]
      subscriptions = subscribe.subscribe(
          tensors, lambda t: script_ops.py_func(sub, [t], [t.dtype])
      )
  
      for tensor, subscription in zip(tensors, subscriptions):
          self.assertIs(context(tensor), context(subscription))
  
      # Verify that sub(x1) and sub(x2) are in the same context.
      self.assertIs(
          context(subscriptions[0]), context(subscriptions[2])
      )
  
      # Verify that sub(x1) and sub(branch) are not.
      self.assertIsNot(
          context(subscriptions[0]), context(subscriptions[1])
      )
  
      with self.cached_session() as sess:
          self.evaluate(cond)
  
      self.assertEqual(3, len(results))
  
imports: import collections
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import sparse_tensor
  from tensorflow.python.framework import subscribe
  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 math_ops
  from tensorflow.python.ops import script_ops
  from tensorflow.python.ops import sparse_ops
  from tensorflow.python.ops import tensor_array_ops
  from tensorflow.python.ops import variable_v1
  from tensorflow.python.platform import googletest
label_desc: Use image node_id 11 for calling the SubscribeTest obj's underlying member method code with example usage: obj.test_subscribe_tensors_within_control_flow_context() and returns: tensor, tensor