parameters: (self, function, args=None, kwargs=None)
return_statement: return resource_remote_value
docstring: Synchronously creates a per-worker resource represented by a `RemoteValue`.
  
      Args:
        function: the resource function to be run remotely. It should be a
          `tf.function`, a concrete function or a Python function.
        args: positional arguments to be passed to the function.
        kwargs: keyword arguments to be passed to the function.
  
      Returns:
        one or several RemoteValue objects depending on the function return
        values.
docstring_summary: Synchronously creates a per-worker resource represented by a `RemoteValue`.
docstring_tokens: Synchronously creates a per - worker resource represented by a RemoteValue .
function: def create_resource(self, function, args=None, kwargs=None):
      """Synchronously creates a per-worker resource represented by a `RemoteValue`.
  
      Args:
        function: the resource function to be run remotely. It should be a
          `tf.function`, a concrete function or a Python function.
        args: positional arguments to be passed to the function.
        kwargs: keyword arguments to be passed to the function.
  
      Returns:
        one or several RemoteValue objects depending on the function return
        values.
      """
      # Some notes about the concurrency: currently all the activities related to
      # the same worker such as creating resources, setting resources' aborted
      # status, and executing closures happen on the same thread. This allows us
      # to have simpler logic of concurrency.
      closure = ResourceClosure(
          function,
          self._cluster.closure_queue._cancellation_mgr,  # pylint: disable=protected-access
          args=args,
          kwargs=kwargs)
      resource_remote_value = closure.build_output_remote_value()
      self._register_resource(resource_remote_value)
  
      # The following is a short-term solution to lazily create resources in
      # parallel.
      # TODO(b/160343165): we should create resources eagerly, i.e. schedule the
      # resource creation function as soon as users call this method.
      resource_remote_value._set_aborted()  # pylint: disable=protected-access
      return resource_remote_value
function_tokens: def create_resource ( self , function , args = None , kwargs = None ) : # Some notes about the concurrency: currently all the activities related to # the same worker such as creating resources, setting resources' aborted # status, and executing closures happen on the same thread. This allows us # to have simpler logic of concurrency. closure = ResourceClosure ( function , self . _cluster . closure_queue . _cancellation_mgr , # pylint: disable=protected-access args = args , kwargs = kwargs ) resource_remote_value = closure . build_output_remote_value ( ) self . _register_resource ( resource_remote_value ) # The following is a short-term solution to lazily create resources in # parallel. # TODO(b/160343165): we should create resources eagerly, i.e. schedule the # resource creation function as soon as users call this method. resource_remote_value . _set_aborted ( ) # pylint: disable=protected-access return resource_remote_value