MCPcopy Create free account
hub / github.com/pytorch/examples / TrainerNet

Class TrainerNet

distributed/rpc/parameter_server/rpc_parameter_server.py:152–168  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

150# forward() method simply invokes the network on the given parameter
151# server.
152class TrainerNet(nn.Module):
153 def __init__(self, num_gpus=0):
154 super().__init__()
155 self.num_gpus = num_gpus
156 self.param_server_rref = rpc.remote(
157 "parameter_server", get_parameter_server, args=(num_gpus,))
158
159 def get_global_param_rrefs(self):
160 remote_params = remote_method(
161 ParameterServer.get_param_rrefs,
162 self.param_server_rref)
163 return remote_params
164
165 def forward(self, x):
166 model_output = remote_method(
167 ParameterServer.forward, self.param_server_rref, x)
168 return model_output
169
170
171def run_training_loop(rank, num_gpus, train_loader, test_loader):

Callers 1

run_training_loopFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected