mirror of
https://github.com/mrdbourke/pytorch-deep-learning.git
synced 2026-11-27 06:07:09 +00:00
Fix to nn.Parameter arguments in 01_pytorch_workflow.ipynb
This commit is contained in:
1 parent
7d1c7a4424
commit
488f45337a
1 file changed
+5
-7
@@ -417,14 +417,12 @@
|
||||
" def __init__(self):\n",
|
||||
" super().__init__() \n",
|
||||
" self.weights = nn.Parameter(torch.randn(1, # <- start with random weights (this will get adjusted as the model learns)\n",
|
||||
" requires_grad=True, # <- can we update this value with gradient descent?\n",
|
||||
" dtype=torch.float # <- PyTorch loves float32 by default\n",
|
||||
" ))\n",
|
||||
" dtype=torch.float), # <- PyTorch loves float32 by default\n",
|
||||
" requires_grad=True) # <- can we update this value with gradient descent?)\n",
|
||||
"\n",
|
||||
" self.bias = nn.Parameter(torch.randn(1, # <- start with random bias (this will get adjusted as the model learns)\n",
|
||||
" requires_grad=True, # <- can we update this value with gradient descent?\n",
|
||||
" dtype=torch.float # <- PyTorch loves float32 by default\n",
|
||||
" ))\n",
|
||||
" dtype=torch.float), # <- PyTorch loves float32 by default\n",
|
||||
" requires_grad=True) # <- can we update this value with gradient descent?))\n",
|
||||
"\n",
|
||||
" # Forward defines the computation in the model\n",
|
||||
" def forward(self, x: torch.Tensor) -> torch.Tensor: # <- \"x\" is the input data (e.g. training/testing features)\n",
|
||||
@@ -2472,7 +2470,7 @@
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.8.13"
|
||||
"version": "3.7.4"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
|
||||
Reference in new issue
Block a user