mirror of
https://github.com/tinygrad/tinygrad.git
synced 2026-01-09 15:08:02 -05:00
Tensor.diagonal (#11122)
only implemented main diagonal for 2-D tensors. with diagonal and qr, we can get determinant
This commit is contained in:
@@ -1933,6 +1933,9 @@ class TestOps(unittest.TestCase):
|
||||
def test_diag(self):
|
||||
helper_test_op([(5,)], lambda x: x.diag())
|
||||
|
||||
def test_diagonal(self):
|
||||
helper_test_op([(5,5)], lambda x: x.diagonal())
|
||||
|
||||
def test_roll(self):
|
||||
helper_test_op([(2, 4)], lambda x: torch.roll(x, 1, 0), lambda x: x.roll(1, 0))
|
||||
helper_test_op([(2, 4)], lambda x: torch.roll(x, -1, 0), lambda x: x.roll(-1, 0))
|
||||
|
||||
Reference in New Issue
Block a user