From 6f40a316acfd0e8176eafbd8178b7d40715a4c82 Mon Sep 17 00:00:00 2001 From: Vasilis Vryniotis Date: Wed, 27 Oct 2021 15:10:20 +0100 Subject: [PATCH] Setting seeds for TestRoiPool backward. --- test/test_ops.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/test_ops.py b/test/test_ops.py index 858880e35bc..3ebb6022e5d 100644 --- a/test/test_ops.py +++ b/test/test_ops.py @@ -46,9 +46,11 @@ def test_forward(self, device, contiguous, x_dtype=None, rois_dtype=None, **kwar tol = 1e-3 if (x_dtype is torch.half or rois_dtype is torch.half) else 1e-5 torch.testing.assert_close(gt_y.to(y), y, rtol=tol, atol=tol) + @pytest.mark.parametrize("seed", range(10)) @pytest.mark.parametrize("device", cpu_and_gpu()) @pytest.mark.parametrize("contiguous", (True, False)) - def test_backward(self, device, contiguous): + def test_backward(self, seed, device, contiguous): + torch.random.manual_seed(seed) pool_size = 2 x = torch.rand(1, 2 * (pool_size ** 2), 5, 5, dtype=self.dtype, device=device, requires_grad=True) if not contiguous: