Tensor.roll supports dims=None (#11313)

This commit is contained in:
chenyu
2025-07-21 17:29:23 -04:00
committed by GitHub
parent 108aac8af4
commit 6e9506e6fd
2 changed files with 10 additions and 2 deletions

View File

@@ -1937,6 +1937,9 @@ class TestOps(unittest.TestCase):
helper_test_op([(5,5)], lambda x: x.diagonal())
def test_roll(self):
helper_test_op([(2, 4)], lambda x: x.roll(1))
helper_test_op([(2, 4)], lambda x: x.roll((1,)))
self.helper_test_exception([(2, 4)], lambda x: x.roll((1,2)), lambda x: x.roll((1,2)), expected=(RuntimeError, AssertionError))
helper_test_op([(2, 4)], lambda x: x.roll(1, 0))
helper_test_op([(2, 4)], lambda x: x.roll(-1, 0))
helper_test_op([(2, 4)], lambda x: x.roll(shifts=(2, 1), dims=(0, 1)))