You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2019/11/21 09:11:53 UTC

[GitHub] [incubator-tvm] yzhliu edited a comment on issue #4382: [TOPI] Fix flaky testcase for floor div

yzhliu edited a comment on issue #4382: [TOPI] Fix flaky testcase for floor div
URL: https://github.com/apache/incubator-tvm/pull/4382#issuecomment-556989979
 
 
   @tqchen I'm afraid the flaky is not only from that around 0.5, I find a case:
   ```python
   import tvm
   import topi
   import numpy as np
   
   dtype = "float32"
   A = tvm.placeholder(name="A", shape=(1,), dtype=dtype)
   B = tvm.placeholder(name="B", shape=(1,), dtype=dtype)
   C = topi.floor_divide(A, B)
   
   with tvm.target.create("llvm"):
       s = topi.generic.schedule_broadcast(C)
       foo = tvm.build(s, [A, B, C], "llvm")
   
   ctx = tvm.cpu()
   #a = np.array([-89.50379]).astype(dtype)
   #b = np.array([7.458649]).astype(dtype)
   a = np.array([94.90735]).astype(dtype)
   b = np.array([0.6731018]).astype(dtype)
   lhs_nd = tvm.nd.array(a, ctx)
   rhs_nd = tvm.nd.array(b, ctx)
   
   out_nd = tvm.nd.array(np.empty((1,)).astype(C.dtype), ctx)
   foo(lhs_nd, rhs_nd, out_nd)
   print("tvm", out_nd.asnumpy())
   print("np", np.floor_divide(a, b))
   print("python", 94.90735 / 0.6731018)
   ```
   
   ```
   $ python test.py 
   tvm [141.]
   np [140.]
   python 140.99999435449436
   ```

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services