(self)
| 648 | np.testing.assert_equal(b.cpu().numpy(), expected.numpy()) |
| 649 | |
| 650 | def test_cumsum_2d(self): |
| 651 | a = torch.arange(12, dtype=torch.float32, device=device).reshape(3, 4) |
| 652 | b = torch.cumsum(a, dim=0) |
| 653 | expected = torch.arange(12, dtype=torch.float32).reshape(3, 4).cumsum(dim=0) |
| 654 | np.testing.assert_equal(b.cpu().numpy(), expected.numpy()) |
| 655 | |
| 656 | c = torch.cumsum(a, dim=1) |
| 657 | expected = torch.arange(12, dtype=torch.float32).reshape(3, 4).cumsum(dim=1) |
| 658 | np.testing.assert_equal(c.cpu().numpy(), expected.numpy()) |
| 659 | |
| 660 | def test_cumsum_backward(self): |
| 661 | a = torch.tensor([1.0, 2.0, 3.0, 4.0], dtype=torch.float32, device=device, requires_grad=True) |
nothing calls this directly
no test coverage detected