class_docstr: A container for all capture usages within FuncGraph.
docstr: Used during tracing process to create/retrive by-ref captures.
  
  Args:
    graph: The FuncGraph that captures this tensor.
    lam: A callable that takes no arguments and returns tensor captures.
    key: A hashable identifier.
  
  Returns:
    Tensor from this FuncGraph.
code: def _capture_by_ref(
      self, graph: Any, lam: Callable[[], Any], key: Hashable = None
  ) -> Any:
      """Used during tracing process to create/retrive by-ref captures.
  
      Args:
        graph: The FuncGraph that captures this tensor.
        lam: A callable that takes no arguments and returns tensor captures.
        key: A hashable identifier.
  
      Returns:
        Tensor from this FuncGraph.
      """
      # Check if the capture exists in self._by_ref
      if key is not None and key in self._by_ref_internal:
          return self._by_ref_internal[key]
      if key is None:
          key = len(self._by_ref_internal)
          while key in self._by_ref_internal:
              key += 1
  
      value_nested = lam()
      capture_trace_type = trace_type.from_value(value_nested)
      ctx = trace_type.InternalPlaceholderContext(graph)
      internal = capture_trace_type.placeholder_value(ctx)
  
      def lam_fn():
          # pytype: disable=attribute-error
          value = lam()
          return capture_trace_type.to_tensors(value)
          # pytype: enable=attribute-error
  
      self._by_ref_external[key] = lam_fn
      self._by_ref_internal[key] = internal
      self._by_ref_tracetype[key] = capture_trace_type
      return self._by_ref_internal[key]
  
imports: import collections
  import functools
  from typing import Any, Callable, Hashable, Mapping, Optional
  from tensorflow.core.function import trace_type
  from tensorflow.python import pywrap_tfe
  from tensorflow.python.framework import dtypes
  from tensorflow.python.types import core
  from tensorflow.python.util import object_identity
label_desc: Use image node_id 7 for calling the FunctionCaptures obj's underlying member method code with example usage: obj._capture_by_ref(graph, lam, key) and returns: self, self, capture_trace_type