cxx122 opened a new issue, #12372:
URL: https://github.com/apache/tvm/issues/12372

   ```
   tensor_1 = te.placeholder((2,2,), dtype="int16", name="A")
   tensor_2 = te.compute((2,3,), lambda dj,z,: tensor_1[z][dj], name ="IR")
   ```
   
   ### Expected behavior
   
   An error message or a definite thing like 'nan' when out of range.
   
   ### Actual behavior
   
   ```
   Traceback (most recent call last):
     File "/Scuzer/src/bugs/bug1_patch/bug1/bug1.py", line 35, in <module>
       tvm.testing.assert_allclose(pre_list[1].numpy(), 
after_list[1].numpy(),rtol=1e-5)
     File "/Scuzer/tvm_cov_patch/tvm/python/tvm/testing/utils.py", line 114, in 
assert_allclose
       np.testing.assert_allclose(actual, desired, rtol=rtol, atol=atol, 
verbose=True)
     File 
"/root/miniconda3/envs/py38/lib/python3.8/site-packages/numpy/testing/_private/utils.py",
 line 1527, in assert_allclose
       assert_array_compare(compare, actual, desired, err_msg=str(err_msg),
     File 
"/root/miniconda3/envs/py38/lib/python3.8/site-packages/numpy/testing/_private/utils.py",
 line 840, in assert_array_compare
       raise AssertionError(msg)
   AssertionError: 
   Not equal to tolerance rtol=1e-05, atol=1e-07
   
   Mismatched elements: 2 / 6 (33.3%)
   Max absolute difference: 29748
   Max relative difference: 1.
    x: array([[ 2,  3, 49],
          [ 4,  2,  0]], dtype=int16)
    y: array([[    2,     3, 29797],
          [    4,     2, 28520]], dtype=int16)
   ```
   
   ### Environment
   
   Operating System: Ubuntu 18.04, TVM version: tag0.9.0 [d361585]
   
   ### Steps to reproduce
   
   ```
   import numpy as np
   import tvm
   from tvm import te, auto_scheduler
   import tvm.testing
   
   tensor_1 = te.placeholder((2,2,), dtype="int16", name="A")
   tensor_2 = te.compute((2,3,), lambda dj,z,: tensor_1[z][dj], name ="IR")
   s = te.create_schedule(tensor_2.op)
   tensor_list = [tensor_1, tensor_2]
   
   dev = tvm.cpu(0)
   pre_list = []
   after_list = []
   for tensor in tensor_list:
       shape = [x.value if 'value' in dir(x) and isinstance(x.value, int) else 
1 for x in tensor.shape]
       params = (5*np.random.uniform(size=shape)).astype(tensor.dtype)
       pre_list.append(tvm.nd.array(params.copy(), dev))
       after_list.append(tvm.nd.array(params.copy(), dev))
   
   print(tvm.lower(s,tensor_list, simple_mode=True))
   with tvm.transform.PassContext(opt_level=4):
       f = tvm.build(s, tensor_list, "llvm")
   f(*pre_list)
   
   print(tvm.lower(s,tensor_list, simple_mode=True))
   with tvm.transform.PassContext(opt_level=4):
       f = tvm.build(s, tensor_list, "llvm")
   f(*after_list)
   
   tvm.testing.assert_allclose(pre_list[1].numpy(), 
after_list[1].numpy(),rtol=1e-5)
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to