Changes

Jump to: navigation, search

DPS921/PyTorch: Convolutional Neural Networks

250 bytes added, 13:15, 30 November 2020
Parallelization Methods
<code>loss_fn(outputs, labels).backward()</code>
<code>optimizer.step()</code>
 
 
model = ToyModel()
loss_fn = nn.MSELoss()
optimizer = optim.SGD(model.parameters(), lr=0.001)
 
optimizer.zero_grad()
outputs = model(torch.randn(20, 10))
labels = torch.randn(20, 5).to('cuda:1')
loss_fn(outputs, labels).backward()
optimizer.step()
56
edits

Navigation menu