From 63bd22eb05c26e4295893d3409b613c788c1819e Mon Sep 17 00:00:00 2001 From: rasbt Date: Fri, 13 Jun 2025 10:57:07 -0500 Subject: [PATCH] Remove redundant model = --- appendix-A/01_main-chapter-code/code-part2.ipynb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/appendix-A/01_main-chapter-code/code-part2.ipynb b/appendix-A/01_main-chapter-code/code-part2.ipynb index b02cdaf7b..0b37dc908 100644 --- a/appendix-A/01_main-chapter-code/code-part2.ipynb +++ b/appendix-A/01_main-chapter-code/code-part2.ipynb @@ -331,7 +331,10 @@ "model = NeuralNetwork(num_inputs=2, num_outputs=2)\n", "\n", "device = torch.device(\"cuda\" if torch.cuda.is_available() else \"cpu\") # NEW\n", - "model = model.to(device) # NEW\n", + "model.to(device) # NEW\n", + "\n", + "# Note that the book originally used the following line, but the \"model =\" is redundant\n", + "# model = model.to(device) # NEW\n", "\n", "optimizer = torch.optim.SGD(model.parameters(), lr=0.5)\n", "\n", @@ -490,7 +493,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.14" + "version": "3.10.16" } }, "nbformat": 4,