parameters: (source_t, target_t)
docstring: Copies HandleData for variant and resource type tensors if available.
  
    The CppShapeInferenceResult::HandleData proto contains information about the
    shapes and types of the element tensors of resource/variant type tensors.
    We need to copy this across function boundaries, i.e., when capturing a
    placeholder or when returning a function tensor as output. If we don't do this
    the element tensors will have unknown shapes, e.g., if a TensorList variant
    tensor is captured as a placeholder, elements popped from that list would have
    unknown shape.
  
    Args:
      source_t: The tensor to copy HandleData from.
      target_t: The tensor to copy HandleData to.
docstring_summary: Copies HandleData for variant and resource type tensors if available.
docstring_tokens: Copies HandleData for variant and resource type tensors if available .
function: def copy_handle_data(source_t, target_t):
    """Copies HandleData for variant and resource type tensors if available.
  
    The CppShapeInferenceResult::HandleData proto contains information about the
    shapes and types of the element tensors of resource/variant type tensors.
    We need to copy this across function boundaries, i.e., when capturing a
    placeholder or when returning a function tensor as output. If we don't do this
    the element tensors will have unknown shapes, e.g., if a TensorList variant
    tensor is captured as a placeholder, elements popped from that list would have
    unknown shape.
  
    Args:
      source_t: The tensor to copy HandleData from.
      target_t: The tensor to copy HandleData to.
    """
    if (target_t.dtype == dtypes.resource or
        target_t.dtype == dtypes.variant):
      if isinstance(source_t, ops.EagerTensor):
        handle_data = source_t._handle_data  # pylint: disable=protected-access
      else:
        handle_data = resource_variable_ops.get_resource_handle_data(source_t)
      if (handle_data is not None
          and handle_data.is_set
          and handle_data.shape_and_type):
        # pylint: disable=protected-access
        pywrap_tensorflow.SetHandleShapeAndType(target_t.graph._c_graph,
                                                target_t._as_tf_output(),
                                                handle_data.SerializeToString())
        # pylint: enable=protected-access
        # Ensure that shapes and dtypes are propagated.
        shapes, types = zip(*[(pair.shape, pair.dtype)
                              for pair in handle_data.shape_and_type])
        ranks = [len(s.dim) if not s.unknown_rank else -1 for s in shapes]
        shapes = [[d.size for d in s.dim]  # pylint: disable=g-complex-comprehension
                  if not s.unknown_rank else None for s in shapes]
        pywrap_tensorflow.TF_GraphSetOutputHandleShapesAndTypes_wrapper(
            target_t._op._graph._c_graph,  # pylint: disable=protected-access
            target_t._as_tf_output(),  # pylint: disable=protected-access
            shapes, ranks, types)
function_tokens: def copy_handle_data ( source_t , target_t ) : if ( target_t . dtype == dtypes . resource or target_t . dtype == dtypes . variant ) : if isinstance ( source_t , ops . EagerTensor ) : handle_data = source_t . _handle_data # pylint: disable=protected-access else : handle_data = resource_variable_ops . get_resource_handle_data ( source_t ) if ( handle_data is not None and handle_data . is_set and handle_data . shape_and_type ) : # pylint: disable=protected-access pywrap_tensorflow . SetHandleShapeAndType ( target_t . graph . _c_graph , target_t . _as_tf_output ( ) , handle_data . SerializeToString ( ) ) # pylint: enable=protected-access # Ensure that shapes and dtypes are propagated. shapes , types = zip ( * [ ( pair . shape , pair . dtype ) for pair in handle_data . shape_and_type ] ) ranks = [ len ( s . dim ) if not s . unknown_rank else - 1 for s in shapes ] shapes = [ [ d . size for d in s . dim ] # pylint: disable=g-complex-comprehension if not s . unknown_rank else None for s in shapes ] pywrap_tensorflow . TF_GraphSetOutputHandleShapesAndTypes_wrapper ( target_t . _op . _graph . _c_graph , # pylint: disable=protected-access target_t . _as_tf_output ( ) , # pylint: disable=protected-access shapes , ranks , types )