fix autograd was not running on device
This commit is contained in:
parent
472f3189c2
commit
27feb8a366
1 changed files with 1 additions and 1 deletions
|
|
@ -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.")
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue