Changes

Jump to: navigation, search

DPS921/PyTorch: Convolutional Neural Networks

148 bytes added, 14:35, 30 November 2020
Single-Machine Model
return self.net2(x.to('cuda:1'))
The code is very similar to a single GPU implementation, except for the ''.to('cuda:x')'' calls, where ''cuda:0'' and ''cuda:1'' are each their own GPU[https://pytorch.org/tutorials/intermediate/model_parallel_tutorial.html].
model = ToyModel()
optimizer.step()
The backward() and torch.optim will automatically take care of gradients as if the model is on one GPU. You only need to make sure that the labels are on the same device as the outputs when calling the loss function[https://pytorch.org/tutorials/intermediate/model_parallel_tutorial.html].
== Getting Started With Jupyter ==
56
edits

Navigation menu