


ret = rpc.rpc_sync("worker1", torch.add, args=(torch.ones(2), 3))
      >>> rpc.shutdown()



  >>> # On worker 1:
  >>> import torch.distributed.rpc as rpc
  >>> rpc.init_rpc("worker1", rank=1, world_size=2)
  >>> rpc.shutdown()

  Below is an example of running a TorchScript function using RPC.

  >>> # On both workers:
  >>> @torch.jit.script
  >>> def my_script_add(t1, t2):
  >>>    return torch.add(t1, t2)

  >>> # On worker 0:
  >>> import torch.distributed.rpc as rpc
  >>> rpc.init_rpc("worker0", rank=0, world_size=2)
  >>> ret = rpc.rpc_sync("worker1", my_script_add, args=(torch.ones(2), 3))
  >>> rpc.shutdown()

  >>> # On worker 1:
  >>> import torch.distributed.rpc as rpc
  >>> rpc.init_rpc("worker1", rank=1, world_size=2)
  >>> rpc.shutdown()

torch.distributed.rpc.rpc_async(to, func, args=None, kwargs=None, timeout=- 1.0)
Make a non-blocking RPC call to run function "func" on worker "to".