This commit is contained in:
Mehnaaz 2024-10-14 20:00:33 +02:00 committed by GitHub
commit fbab48042d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -4825,10 +4825,10 @@
"class BasicOptim:\n", "class BasicOptim:\n",
" def __init__(self,params,lr): self.params,self.lr = list(params),lr\n", " def __init__(self,params,lr): self.params,self.lr = list(params),lr\n",
"\n", "\n",
" def step(self, *args, **kwargs):\n", " def step(self):\n",
" for p in self.params: p.data -= p.grad.data * self.lr\n", " for p in self.params: p.data -= p.grad.data * self.lr\n",
"\n", "\n",
" def zero_grad(self, *args, **kwargs):\n", " def zero_grad(self):\n",
" for p in self.params: p.grad = None" " for p in self.params: p.grad = None"
] ]
}, },