|
|
@@ -1230,7 +1230,7 @@
|
|
|
" model.train() # Set model to training mode\n",
|
|
|
" \n",
|
|
|
" for input_batch, target_batch in train_loader:\n",
|
|
|
- " optimizer.zero_grad() # Reset loss gradients from previous epoch\n",
|
|
|
+ " optimizer.zero_grad() # Reset loss gradients from previous batch iteration\n",
|
|
|
" loss = calc_loss_batch(input_batch, target_batch, model, device)\n",
|
|
|
" loss.backward() # Calculate loss gradients\n",
|
|
|
" optimizer.step() # Update model weights using loss gradients\n",
|
|
|
@@ -2477,7 +2477,7 @@
|
|
|
"name": "python",
|
|
|
"nbconvert_exporter": "python",
|
|
|
"pygments_lexer": "ipython3",
|
|
|
- "version": "3.11.4"
|
|
|
+ "version": "3.10.6"
|
|
|
}
|
|
|
},
|
|
|
"nbformat": 4,
|