Skip to content

Commit

Permalink
PrintOP support more dtypes (PaddlePaddle#58031)
Browse files Browse the repository at this point in the history
增加 Print OP 支持的数据类型,便于静态图在半精度下的调试
  • Loading branch information
lanxianghit authored Oct 12, 2023
1 parent 4a9c57f commit 83e109c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion python/paddle/static/nn/control_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -1711,7 +1711,7 @@ def Print(
check_variable_and_dtype(
input,
'input',
['float32', 'float64', 'int32', 'int64', 'bool'],
['uint16', 'float16', 'float32', 'float64', 'int32', 'int64', 'bool'],
'paddle.static.Print',
)

Expand Down
4 changes: 2 additions & 2 deletions test/legacy_test/test_print_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ def test_errors(self):
np.array([[-1]]), [[1]], paddle.CPUPlace()
)
self.assertRaises(TypeError, paddle.static.Print, x1)
# The input dtype of Print_op must be float32, float64, int32_t, int64_t or bool.
x2 = paddle.static.data(name='x2', shape=[4], dtype="float16")
# The input dtype of Print_op must be uint16, float16, float32, float64, int32_t, int64_t or bool.
x2 = paddle.static.data(name='x2', shape=[4], dtype="int8")
self.assertRaises(TypeError, paddle.static.Print, x2)


Expand Down

0 comments on commit 83e109c

Please sign in to comment.