tqchen commented on a change in pull request #4382: [TOPI] Fix flaky testcase
for floor div
URL: https://github.com/apache/incubator-tvm/pull/4382#discussion_r348876176
##########
File path: topi/tests/python/test_topi_broadcast.py
##########
@@ -71,27 +99,19 @@ def check_device(device):
with tvm.target.create(device):
s = topi.generic.schedule_broadcast(C)
foo = tvm.build(s, [A, B, C], device, name="broadcast_binary" + "_" +
ftopi.__name__)
- if lhs_shape is None:
- lhs_npy = float(np.random.uniform(low=lhs_min, high=lhs_max))
- if dtype.startswith('int'):
- lhs_npy = int(lhs_npy)
- lhs_nd = lhs_npy
- else:
- lhs_npy = np.random.uniform(low=lhs_min, high=lhs_max,
- size=lhs_shape).astype(A.dtype)
- lhs_nd = tvm.nd.array(lhs_npy, ctx)
- if rhs_shape is None:
- rhs_npy = float(np.random.uniform(low=rhs_min, high=rhs_max))
- if dtype.startswith('int'):
- rhs_npy = int(rhs_npy)
- rhs_nd = rhs_npy
- else:
- rhs_npy = np.random.uniform(low=rhs_min, high=rhs_max,
- size=rhs_shape).astype(A.dtype)
- rhs_nd = tvm.nd.array(rhs_npy, ctx)
+ lhs_npy, lhs_nd = gen_operand(lhs_shape, lhs_min, lhs_max, ctx)
+ rhs_npy, rhs_nd = gen_operand(rhs_shape, rhs_min, rhs_max, ctx)
out_npy = fnumpy(lhs_npy, rhs_npy)
+ # avoid check too close to 0.5
+ unstable_points = np.abs(out_npy) - 0.5 < 1e-6
Review comment:
need to do fmod, because 1.5 and other parts are also related. You don't
have to
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services