Correct batch_idx in appendix A logging (#942)

* Correct batch_idx in appendix A logging

* update batch idx

---------

Co-authored-by: Sebastian Raschka <sebastian@Sebastians-MacBook-Air.local>
This commit is contained in:
Henry
2026-01-08 09:14:17 +08:00
committed by GitHub
parent 491fd58463
commit 9df9e69cd2
2 changed files with 29 additions and 29 deletions

View File

@@ -46,7 +46,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"2.4.0\n"
"2.9.1\n"
]
}
],
@@ -658,13 +658,13 @@
"output_type": "stream",
"text": [
"Parameter containing:\n",
"tensor([[ 0.1182, 0.0606, -0.1292, ..., -0.1126, 0.0735, -0.0597],\n",
" [-0.0249, 0.0154, -0.0476, ..., -0.1001, -0.1288, 0.1295],\n",
" [ 0.0641, 0.0018, -0.0367, ..., -0.0990, -0.0424, -0.0043],\n",
"tensor([[ 0.0979, 0.0412, 0.1005, ..., -0.0544, -0.0804, 0.0842],\n",
" [-0.0115, 0.0382, -0.0261, ..., 0.0573, 0.1094, 0.1364],\n",
" [ 0.0162, -0.0050, 0.0752, ..., 0.1298, 0.1250, -0.0117],\n",
" ...,\n",
" [ 0.0618, 0.0867, 0.1361, ..., -0.0254, 0.0399, 0.1006],\n",
" [ 0.0842, -0.0512, -0.0960, ..., -0.1091, 0.1242, -0.0428],\n",
" [ 0.0518, -0.1390, -0.0923, ..., -0.0954, -0.0668, -0.0037]],\n",
" [-0.0312, 0.1319, -0.0954, ..., -0.1066, -0.0970, -0.0373],\n",
" [ 0.0563, -0.1373, -0.1226, ..., 0.0154, -0.0969, 0.0113],\n",
" [-0.0872, -0.0098, 0.0322, ..., -0.0108, 0.1091, -0.1043]],\n",
" requires_grad=True)\n"
]
}
@@ -1002,12 +1002,12 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Epoch: 001/003 | Batch 000/002 | Train/Val Loss: 0.75\n",
"Epoch: 001/003 | Batch 001/002 | Train/Val Loss: 0.65\n",
"Epoch: 002/003 | Batch 000/002 | Train/Val Loss: 0.44\n",
"Epoch: 002/003 | Batch 001/002 | Train/Val Loss: 0.13\n",
"Epoch: 003/003 | Batch 000/002 | Train/Val Loss: 0.03\n",
"Epoch: 003/003 | Batch 001/002 | Train/Val Loss: 0.00\n"
"Epoch: 001/003 | Batch 001/002 | Train/Val Loss: 0.75\n",
"Epoch: 001/003 | Batch 002/002 | Train/Val Loss: 0.65\n",
"Epoch: 002/003 | Batch 001/002 | Train/Val Loss: 0.44\n",
"Epoch: 002/003 | Batch 002/002 | Train/Val Loss: 0.13\n",
"Epoch: 003/003 | Batch 001/002 | Train/Val Loss: 0.03\n",
"Epoch: 003/003 | Batch 002/002 | Train/Val Loss: 0.00\n"
]
}
],
@@ -1036,7 +1036,7 @@
" \n",
" ### LOGGING\n",
" print(f\"Epoch: {epoch+1:03d}/{num_epochs:03d}\"\n",
" f\" | Batch {batch_idx:03d}/{len(train_loader):03d}\"\n",
" f\" | Batch {batch_idx+1:03d}/{len(train_loader):03d}\"\n",
" f\" | Train/Val Loss: {loss:.2f}\")\n",
"\n",
" model.eval()\n",
@@ -1080,11 +1080,11 @@
"name": "stdout",
"output_type": "stream",
"text": [
"tensor([[ 0.9991, 0.0009],\n",
" [ 0.9982, 0.0018],\n",
" [ 0.9949, 0.0051],\n",
" [ 0.0491, 0.9509],\n",
" [ 0.0307, 0.9693]])\n",
"tensor([[0.9991, 0.0009],\n",
" [0.9982, 0.0018],\n",
" [0.9949, 0.0051],\n",
" [0.0491, 0.9509],\n",
" [0.0307, 0.9693]])\n",
"tensor([0, 0, 0, 1, 1])\n"
]
}
@@ -1340,7 +1340,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.4"
"version": "3.11.11"
}
},
"nbformat": 4,

View File

@@ -301,7 +301,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": null,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
@@ -314,12 +314,12 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Epoch: 001/003 | Batch 000/002 | Train/Val Loss: 0.75\n",
"Epoch: 001/003 | Batch 001/002 | Train/Val Loss: 0.65\n",
"Epoch: 002/003 | Batch 000/002 | Train/Val Loss: 0.44\n",
"Epoch: 002/003 | Batch 001/002 | Train/Val Loss: 0.13\n",
"Epoch: 003/003 | Batch 000/002 | Train/Val Loss: 0.03\n",
"Epoch: 003/003 | Batch 001/002 | Train/Val Loss: 0.00\n"
"Epoch: 001/003 | Batch 001/002 | Train/Val Loss: 0.75\n",
"Epoch: 001/003 | Batch 002/002 | Train/Val Loss: 0.65\n",
"Epoch: 002/003 | Batch 001/002 | Train/Val Loss: 0.44\n",
"Epoch: 002/003 | Batch 002/002 | Train/Val Loss: 0.13\n",
"Epoch: 003/003 | Batch 001/002 | Train/Val Loss: 0.03\n",
"Epoch: 003/003 | Batch 002/002 | Train/Val Loss: 0.00\n"
]
}
],
@@ -355,7 +355,7 @@
"\n",
" ### LOGGING\n",
" print(f\"Epoch: {epoch+1:03d}/{num_epochs:03d}\"\n",
" f\" | Batch {batch_idx:03d}/{len(train_loader):03d}\"\n",
" f\" | Batch {batch_idx+1:03d}/{len(train_loader):03d}\"\n",
" f\" | Train/Val Loss: {loss:.2f}\")\n",
"\n",
" model.eval()\n",
@@ -493,7 +493,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.16"
"version": "3.11.11"
}
},
"nbformat": 4,