未验证 提交 f534c66d 编写于 作者: F flame 提交者: GitHub

fix test_word2vec bug (#15462)

fix test_word2vec float's equality bug
上级 b3fdf708
...@@ -220,9 +220,7 @@ def infer(use_cuda, save_dirname=None): ...@@ -220,9 +220,7 @@ def infer(use_cuda, save_dirname=None):
np_data = np.array(results[0]) np_data = np.array(results[0])
infer_out = infer_outputs[0].data.float_data() infer_out = infer_outputs[0].data.float_data()
for a, b in zip(np_data[0], infer_out): for a, b in zip(np_data[0], infer_out):
g_a = float("{:.6g}".format(a)) assert np.isclose(a, b), "a: {}, b: {}".format(a, b)
g_b = float("{:.6g}".format(b))
assert g_a == g_b
def main(use_cuda, is_sparse, is_parallel): def main(use_cuda, is_sparse, is_parallel):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册