docstr: Confirm caching of control output is recalculated between calls.
docstr_tok: ["Confirm","caching","of","control","output","is","recalculated","between","calls","."]
code: def testCaching(self):
      """Confirm caching of control output is recalculated between calls."""
      a = constant_op.constant(1)
      b = constant_op.constant(2)
      with ops.control_dependencies([a]):
          c = constant_op.constant(42)
  
      shared = {}
  
      def sub(t):
          shared[t] = shared.get(t, 0) + 1
          return t
  
      a = subscribe.subscribe(
          a, lambda t: script_ops.py_func(sub, [t], [t.dtype])
      )
  
      with ops.control_dependencies([b]):
          d = constant_op.constant(11)
  
      # If it was using outdated cached control_outputs then
      # evaling would not trigger the new subscription.
      b = subscribe.subscribe(
          b, lambda t: script_ops.py_func(sub, [t], [t.dtype])
      )
  
      with self.cached_session() as sess:
          c_out = self.evaluate([c])
          d_out = self.evaluate([d])
  
      self.assertEqual(c_out, [42])
      self.assertEqual(d_out, [11])
      self.assertEqual(shared, {2: 1, 1: 1})
  
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 4 for calling the SubscribeTest obj's underlying member method code with example usage: obj.testCaching() and returns: t