A RemoteModule instance can only be created after RPC initialization.
It creates a user-specified module on a specified remote node.
It behaves like a regular nn.Module except that the forward method is
executed on the remote node.
It takes care of autograd recording to ensure the backward pass propagates
gradients back to the corresponding remote module.
It generates two methods forward_async and forward based on the
signature of the forward method of module_cls. forward_async
runs asynchronously and returns a Future. The arguments of forward_async
and forward are the same as the forward method of the module
returned by the module_cls.
For example, if module_cls returns an instance of nn.Linear,
that has forward method signature: def forward(input: Tensor) -> Tensor:,
the generated RemoteModule will have 2 methods with the signatures:
def forward(input: Tensor) -> Tensor:
def forward_async(input: Tensor) -> Future[Tensor]: