tvm.testing.assert_allclose(op_res.asnumpy(), np_values)
else:
tvm.testing.assert_allclose(op_res.asnumpy(), np_indices)
+ np.random.seed(0)
for k in [0, 1, 5]:
for axis in [0, -1, 1]:
for ret_type in ["both", "values", "indices"]:
- for dtype in ["int64", "float32"]:
- verify_topk(k, axis, ret_type, False, dtype)
- verify_topk(k, axis, ret_type, True, dtype)
+ verify_topk(k, axis, ret_type, True, "int64")
+ verify_topk(k, axis, ret_type, False, "float32")
if __name__ == "__main__":
out = relay.Function(relay.ir_pass.free_vars(out), out)
return out
+ np.random.seed(42)
+
data = relay.var("data", relay.TensorType((n, c, h, w), "float32"))
graph = make_graph(data)
dataset, params = make_dataset(graph, 10)
if __name__ == "__main__":
- np.random.seed(42)
test_simulated_quantize()
test_quantize_pass()
check_device(device)
def test_topk():
+ np.random.seed(0)
for k in [0, 1, 5]:
for axis in [0, -1, 1]:
for ret_type in ["both", "values", "indices"]:
- for dtype in ["int64", "float32"]:
- verify_topk(k, axis, ret_type, True, dtype)
- verify_topk(k, axis, ret_type, False, dtype)
+ verify_topk(k, axis, ret_type, True, "int64")
+ verify_topk(k, axis, ret_type, False, "float32")
if __name__ == "__main__":