Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
<pre> | |
for batch in dataloader: | |
inputs, targets = batch | |
inputs = inputs.to(device) | |
targets = targets.to(device) | |
outputs = model(inputs) | |
loss = loss_function(outputs, targets) | |
loss.backward() | |
optimizer.step() | |
scheduler.step() | |
optimizer.zero_grad()</pre> |