def test_triu(self): x = torch.rand(SIZE, SIZE) res1 = torch.triu(x) res2 = torch.Tensor() torch.triu(x, out=res2) self.assertEqual(res1, res2, 0)