mirror of
https://github.com/rasbt/LLMs-from-scratch.git
synced 2025-08-28 18:40:01 +00:00
Remove redundant model = (#663)
This commit is contained in:
parent
a0f5326a25
commit
d9dd94dac6
@ -331,7 +331,10 @@
|
|||||||
"model = NeuralNetwork(num_inputs=2, num_outputs=2)\n",
|
"model = NeuralNetwork(num_inputs=2, num_outputs=2)\n",
|
||||||
"\n",
|
"\n",
|
||||||
"device = torch.device(\"cuda\" if torch.cuda.is_available() else \"cpu\") # NEW\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",
|
"\n",
|
||||||
"optimizer = torch.optim.SGD(model.parameters(), lr=0.5)\n",
|
"optimizer = torch.optim.SGD(model.parameters(), lr=0.5)\n",
|
||||||
"\n",
|
"\n",
|
||||||
@ -490,7 +493,7 @@
|
|||||||
"name": "python",
|
"name": "python",
|
||||||
"nbconvert_exporter": "python",
|
"nbconvert_exporter": "python",
|
||||||
"pygments_lexer": "ipython3",
|
"pygments_lexer": "ipython3",
|
||||||
"version": "3.10.14"
|
"version": "3.10.16"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nbformat": 4,
|
"nbformat": 4,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user