only float Tensors have gradient [pr] (#10475)

This commit is contained in:
chenyu
2025-05-22 21:02:11 -04:00
committed by GitHub
parent 147f7747f2
commit 8cc2dff4d8
3 changed files with 7 additions and 1 deletions

View File

@@ -494,7 +494,7 @@ class TestTinygrad(unittest.TestCase):
_a = Tensor([3]) in [Tensor([3]), Tensor([4]), Tensor([5])]
def test_repr_with_grad(self):
a = Tensor([1], requires_grad=True)
a = Tensor([1.0], requires_grad=True)
b = Tensor([1])
c = (a + b).sum().backward()
print(a)