code: def create_deferred(self, func, input_layer, deferred_args, deferred_kwargs,
                        name):
      
      my_defaults = _defaults
  
      def _with_method_complete(*args, **kwargs):
        input_layer = args[0]
        with input_layer.g.as_default(), defaults_scope(**my_defaults), \
            tf.name_scope(name):
          return input_layer._method_complete(func(*args, **kwargs))
      # The deferred layer passes on the scope of the source layer so that the
      # construction scope matches that of the immediate version.
      full_args = [input_layer]
      full_args.extend(deferred_args)
      partial_context = {}
      if isinstance(input_layer, _DeferredLayer):
        partial_context = input_layer._partial_context
      return _DeferredLayer(input_layer.bookkeeper,
                            scopes.Template(None, _with_method_complete),
                            full_args,
                            deferred_kwargs,
                            scope=input_layer._scope,
                            defaults=input_layer.defaults,
                            partial_context=partial_context)
docs: Creates a deferred node with captured scope.
  
      Args:
        func: The original function to call.
        input_layer: The input_layer.
        deferred_args: The arguments that will be used bythe deferred function.
        deferred_kwargs: The keyword args for the deferred function.
        name: The name of this layer.
      Returns:
        A _DeferredLayer that will execute func in the correct scopes.