fix autograd was not running on device

This commit is contained in:
lucasdelimanogueira 2024-05-23 12:07:17 -03:00
parent 472f3189c2
commit 27feb8a366

View file

@ -205,7 +205,7 @@ class Tensor:
if gradient is None:
if self.shape == [1]:
gradient = Tensor([1])
gradient = Tensor([1]).to(self.device)
else:
raise RuntimeError("Gradient argument must be specified for non-scalar tensors.")