mirror of
https://github.com/tinygrad/tinygrad.git
synced 2026-04-29 03:00:14 -04:00
fix advanced setitem with 1 in shape (#7797)
* fix advanced setitem with 1 in shape * linter
This commit is contained in:
@@ -94,6 +94,11 @@ class TestSetitem(unittest.TestCase):
|
||||
t[[1,1]] = Tensor([1,0])
|
||||
np.testing.assert_allclose(t.numpy(), [1,0,3,4])
|
||||
|
||||
def test_setitem_with_1_in_shape(self):
|
||||
t = Tensor([[1],[2],[3]])
|
||||
t[[0,0]] = Tensor([[1],[2]])
|
||||
np.testing.assert_allclose(t.numpy(), [[2],[2],[3]])
|
||||
|
||||
def test_fancy_setitem(self):
|
||||
t = Tensor.zeros(6,6).contiguous()
|
||||
t[[1,2], [3,2]] = 3
|
||||
|
||||
Reference in New Issue
Block a user