Skip to content

Commit 886b0b8

Browse files
Fix tolerance
1 parent 85616c9 commit 886b0b8

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

dpnp/tests/test_statistics.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,9 +199,14 @@ def test_convolve_random(self, a_size, v_size, mode, dtype, method):
199199
else:
200200
result = result.astype(rdtype)
201201
if method == "direct":
202-
expected = numpy.convolve(an, vn, **numpy_kwargs)
203202
# For 'direct' method we can use standard validation
204-
assert_dtype_allclose(result, expected, factor=30)
203+
# acceptable error depends on the kernel size
204+
# while error grows linearly with the kernel size,
205+
# this empirically found formula provides a good balance
206+
# the resulting factor is 40 for kernel size = 1,
207+
# 400 for kernel size = 100 and 4000 for kernel size = 10000
208+
factor = int(40 * (min(a_size, v_size) ** 0.5))
209+
assert_dtype_allclose(result, expected, factor=factor)
205210
else:
206211
rtol = 1e-3
207212
atol = 1e-10

0 commit comments

Comments
 (0)