This is an automated email from the ASF dual-hosted git repository.

mshr pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm.git


The following commit(s) were added to refs/heads/main by this push:
     new 5015047b95 [Relax] Fix flaky test_conv2d gradient numeric test (#18620)
5015047b95 is described below

commit 5015047b95ac795860dc59a6412a1a2ba50cd57c
Author: Guan-Ming (Wesley) Chiu <[email protected]>
AuthorDate: Sat Dec 27 16:53:40 2025 +0800

    [Relax] Fix flaky test_conv2d gradient numeric test (#18620)
    
    ## Why
    
    Flaky in CI due to numerical precision errors in gradient checks.
    ref: https://github.com/apache/tvm/pull/18575
    
    ## How
    
    - Reduce input range from (0, 3) to (0, 2) to minimize floating-point
    errors
---
 tests/python/relax/test_op_gradient_numeric.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tests/python/relax/test_op_gradient_numeric.py 
b/tests/python/relax/test_op_gradient_numeric.py
index c76c150f6a..128c75586b 100644
--- a/tests/python/relax/test_op_gradient_numeric.py
+++ b/tests/python/relax/test_op_gradient_numeric.py
@@ -781,8 +781,9 @@ def test_nll_loss_no_batch(target, dev, nll_reduction1, 
nll_weighted1, nll_ignor
 
 @tvm.testing.parametrize_targets("llvm")
 def test_conv2d(target, dev, c2d_shape1, c2d_shape2, c2d_kwargs):
-    data1_numpy = np.random.uniform(0, 3, c2d_shape1).astype(np.float32)
-    data2_numpy = np.random.uniform(0, 3, c2d_shape2).astype(np.float32)
+    # Use smaller range to reduce numerical errors in gradient check
+    data1_numpy = np.random.uniform(0, 2, c2d_shape1).astype(np.float32)
+    data2_numpy = np.random.uniform(0, 2, c2d_shape2).astype(np.float32)
     relax_check_gradients(
         relax.op.nn.conv2d,
         [data1_numpy, data2_numpy],

Reply via email to