docstr: Confirm that subscribe correctly handles tensors with 'resource' type.
docstr_tok: ["Confirm","that","subscribe","correctly","handles","tensors","with","'resource","'","type","."]
code: def testResourceType(self):
      """Confirm that subscribe correctly handles tensors with 'resource' type."""
      tensor_array = tensor_array_ops.TensorArray(
          dtype=dtypes.float32,
          tensor_array_name="test",
          size=3,
          infer_shape=False,
      )
      writer = tensor_array.write(0, [[4.0, 5.0]])
      reader = writer.read(0)
  
      shared = []
  
      def sub(t):
          shared.append(t)
          return t
  
      # TensorArray's handle output tensor has a 'resource' type and cannot be
      # subscribed as it's not 'numpy compatible' (see dtypes.py).
      # Expect that the original tensor is returned when subscribing to it.
      tensor_array_sub = subscribe.subscribe(
          tensor_array.handle,
          lambda t: script_ops.py_func(sub, [t], [t.dtype]),
      )
      self.assertIs(tensor_array_sub, tensor_array.handle)
      self.assertFalse(
          subscribe._is_subscribed_identity(tensor_array.handle)
      )
  
      with self.cached_session() as sess:
          self.evaluate([reader])
      self.assertEqual(0, len(shared))
  
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 8 for calling the SubscribeTest obj's underlying member method code with example usage: obj.testResourceType() and returns: t