未验证 提交 570b7389 编写于 作者: M Michał Gallus 提交者: GitHub

Fix OpTester from incorrectly converting uint8 data to utf-8 string (#24854)

test=develop
上级 2ca2b90d
......@@ -308,7 +308,6 @@ class OpTest(unittest.TestCase):
else:
tensor.set(self.inputs[var_name], place)
feed_map[var_name] = tensor
return feed_map
def _append_ops(self, block):
......@@ -630,24 +629,23 @@ class OpTest(unittest.TestCase):
# computational consistency.
# When inplace_atol is not None, the inplace check uses numpy.allclose
# to check inplace result instead of numpy.array_equal.
expect_out = np.array(expect_outs[i])
actual_out = np.array(actual_outs[i])
if inplace_atol is not None:
self.assertTrue(
np.allclose(
np.array(expect_outs[i]),
np.array(actual_outs[i]),
atol=inplace_atol),
expect_out, actual_out, atol=inplace_atol),
"Output (" + name + ") has diff at " + str(place) +
" when using and not using inplace" + "\nExpect " +
str(expect_outs[i]) + "\n" + "But Got" + str(actual_outs[i])
+ " in class " + self.__class__.__name__)
str(expect_out) + "\n" + "But Got" + str(actual_out) +
" in class " + self.__class__.__name__)
else:
self.assertTrue(
np.array_equal(
np.array(expect_outs[i]), np.array(actual_outs[i])),
np.array_equal(expect_out, actual_out),
"Output (" + name + ") has diff at " + str(place) +
" when using and not using inplace" + "\nExpect " +
str(expect_outs[i]) + "\n" + "But Got" + str(actual_outs[i])
+ " in class " + self.__class__.__name__ + '\n')
str(expect_out) + "\n" + "But Got" + str(actual_out) +
" in class " + self.__class__.__name__ + '\n')
def _construct_grad_program_from_forward(self, fwd_program, grad_op_desc,
op_grad_to_var):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册