Skip to content

Commit

Permalink
Fix OpTester from incorrectly converting uint8 data to utf-8 string
Browse files Browse the repository at this point in the history
test=develop
  • Loading branch information
Sand3r- committed Jun 3, 2020
1 parent a125697 commit 14e7005
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions python/paddle/fluid/tests/unittests/op_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,6 @@ def feed_var(self, input_vars, place):
else:
tensor.set(self.inputs[var_name], place)
feed_map[var_name] = tensor

return feed_map

def _append_ops(self, block):
Expand Down Expand Up @@ -630,24 +629,23 @@ def _compare_expect_and_actual_outputs(self,
# 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):
Expand Down

0 comments on commit 14e7005

Please sign in to comment.