Fix bad unit test merge
@@ -34,43 +34,6 @@ class TestDiagLazyTensorBatch(BatchLazyTensorTestCase, unittest.TestCase):
diag = lazy_tensor._diag
return torch.cat([diag[i].diag().unsqueeze(0) for i in range(3)])
- def test_add_diag(self):
- other_diag = torch.tensor(1.5)
- res = DiagLazyTensor(diag).add_diag(other_diag).evaluate()
- actual = diag.diag() + torch.eye(3).mul(1.5)
- self.assertTrue(approx_equal(res, actual))
-
- other_diag = torch.tensor([1.5])
- res = DiagLazyTensor(diag).add_diag(other_diag).evaluate()
- actual = diag.diag() + torch.eye(3).mul(1.5)
- self.assertTrue(approx_equal(res, actual))
-
- other_diag = torch.tensor([1.5, 1.3, 1.2])
- res = DiagLazyTensor(diag).add_diag(other_diag).evaluate()
- actual = diag.diag() + other_diag.diag()
- self.assertTrue(approx_equal(res, actual))
-
- other_diag = torch.tensor(1.5)
- res = DiagLazyTensor(diag.unsqueeze(0).repeat(2, 1)).add_diag(other_diag).evaluate()
- actual = diag.diag().unsqueeze(0) + torch.eye(3).unsqueeze(0).repeat(2, 1, 1).mul(1.5)
- self.assertTrue(approx_equal(res, actual))
-
- other_diag = torch.tensor([1.5])
- res = DiagLazyTensor(diag.unsqueeze(0).repeat(2, 1)).add_diag(other_diag).evaluate()
- actual = diag.diag().unsqueeze(0) + torch.eye(3).unsqueeze(0).repeat(2, 1, 1).mul(1.5)
- self.assertTrue(approx_equal(res, actual))
-
- other_diag = torch.tensor([1.5, 1.3, 1.2])
- res = DiagLazyTensor(diag.unsqueeze(0).repeat(2, 1)).add_diag(other_diag).evaluate()
- actual = diag.diag().unsqueeze(0) + other_diag.diag().unsqueeze(0).repeat(2, 1, 1)
- self.assertTrue(approx_equal(res, actual))
-
- other_diag = torch.tensor([[1.5, 1.3, 1.2], [0, 1, 2]])
- res = DiagLazyTensor(diag.unsqueeze(0).repeat(2, 1)).add_diag(other_diag).evaluate()
- actual = diag.diag().unsqueeze(0)
- actual = actual + torch.cat([other_diag[0].diag().unsqueeze(0), other_diag[1].diag().unsqueeze(0)])
- self.assertTrue(approx_equal(res, actual))
-
if __name__ == "__main__":
unittest.main()
