parameters: (self, closure, spec, key=None)
return_statement: return self._deferred_captures[key][1]
docstring: Creates a placeholder which at call time has the value closure().
  
      Useful, for example, to respect TensorFlow context managers, which are often
      dynamically scoped.
  
      Args:
        closure: function which takes no arguments, to be evaluated at function
         call time, returning a nest of tensors compatible with `spec`.
        spec: nest of TypeSpec for the value to capture.
        key: optional. If not None, multiple calls to lazy_capture with the same
         key in the same graph will return the same placeholder, and the
         first closure will be used at function call time.
  
      Returns:
        Nest of placeholders which, at function call time, will be fed with the
        result of calling closure().
  
      Raises:
        ValueError: at function call time, if the return value of closure() is
         not compatible with `spec`.
docstring_summary: Creates a placeholder which at call time has the value closure().
docstring_tokens: Creates a placeholder which at call time has the value closure () .
function: def capture_call_time_value(self, closure, spec, key=None):
      """Creates a placeholder which at call time has the value closure().
  
      Useful, for example, to respect TensorFlow context managers, which are often
      dynamically scoped.
  
      Args:
        closure: function which takes no arguments, to be evaluated at function
         call time, returning a nest of tensors compatible with `spec`.
        spec: nest of TypeSpec for the value to capture.
        key: optional. If not None, multiple calls to lazy_capture with the same
         key in the same graph will return the same placeholder, and the
         first closure will be used at function call time.
  
      Returns:
        Nest of placeholders which, at function call time, will be fed with the
        result of calling closure().
  
      Raises:
        ValueError: at function call time, if the return value of closure() is
         not compatible with `spec`.
      """
      if key is None:
        key = object()
      if key not in self._deferred_captures:
  
        def convert_to_placeholder(s):
          if not isinstance(s, tensor_spec.TensorSpec):
            raise TypeError(
                "Expected a nest of `TypeSpec` objects, found %s of type %s." %
                (s, type(s)))
          return array_ops.placeholder(dtype=s.dtype, shape=s.shape)
  
        placeholder = nest.map_structure(
            convert_to_placeholder, spec, expand_composites=True)
  
        def wrapped_closure():
          ret_nest = closure()
          nest.assert_same_structure(spec, ret_nest, expand_composites=True)
          # This uses the tensor dtype defined in `spec` when converting values
          # in `ret_nest` to tensors.
          # pylint: disable=protected-access
          y = nest.map_structure(lambda s, r: s._to_components(r), spec, ret_nest,
                                 expand_composites=False)
          # pylint: enable=protected-access
          return nest.flatten(y, expand_composites=True)
  
        self._deferred_captures[key] = (wrapped_closure, placeholder)
      return self._deferred_captures[key][1]
function_tokens: def capture_call_time_value ( self , closure , spec , key = None ) : if key is None : key = object ( ) if key not in self . _deferred_captures : def convert_to_placeholder ( s ) : if not isinstance ( s , tensor_spec . TensorSpec ) : raise TypeError ( "Expected a nest of `TypeSpec` objects, found %s of type %s." % ( s , type ( s ) ) ) return array_ops . placeholder ( dtype = s . dtype , shape = s . shape ) placeholder = nest . map_structure ( convert_to_placeholder , spec , expand_composites = True ) def wrapped_closure ( ) : ret_nest = closure ( ) nest . assert_same_structure ( spec , ret_nest , expand_composites = True ) # This uses the tensor dtype defined in `spec` when converting values # in `ret_nest` to tensors. # pylint: disable=protected-access y = nest . map_structure ( lambda s , r : s . _to_components ( r ) , spec , ret_nest , expand_composites = False ) # pylint: enable=protected-access return nest . flatten ( y , expand_composites = True ) self . _deferred_captures [ key ] = ( wrapped_closure , placeholder ) return self . _deferred_captures [ key ] [ 1 ]