Skip to content
1 change: 1 addition & 0 deletions python/paddle/tensor/math.py
Original file line number Diff line number Diff line change
Expand Up @@ -6223,6 +6223,7 @@ def sgn(x, name=None):
(-1+0j) ]])

"""

if x.dtype not in [
paddle.float16,
paddle.float32,
Expand Down
3 changes: 3 additions & 0 deletions test/legacy_test/test_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ def test_error(self):
self.assertRaises(AssertionError, paddle.static.data, 'a', [2, 25])
paddle.enable_static()

paddle.jit.enable_to_static(True)
paddle.jit.enable_to_static(False)


if __name__ == "__main__":
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅验证单测中有 enable_to_static 会报错

2023-12-15 17:52:52 ****************-----------------
2023-12-15 17:52:52 +++ b/test/legacy_test/test_data.py + paddle.jit.enable_to_static(True) + paddle.jit.enable_to_static(False) +
2023-12-15 17:52:52 + paddle.jit.enable_to_static(True) + paddle.jit.enable_to_static(False)
2023-12-15 17:52:52 ****************-----------------
2023-12-15 17:53:25 ****************
2023-12-15 17:53:25 0. You must have one RD (SigureMo, Aurelius84 or 2742195759) approval for using 'paddle.jit.enable_to_static', we recommend using 'enable_to_static_guard' in the related test files.
2023-12-15 17:53:25 There are 1 approved errors.
2023-12-15 17:53:25 ****************

image
image

unittest.main()
11 changes: 11 additions & 0 deletions tools/check_file_diff_approvals.sh
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,17 @@ if [ "${DEPRECATED_FLAKE8}" != "" ] && [ "${GIT_PR_ID}" != "" ]; then
check_approval 1 SigureMo gouzil
fi

TEST_FILE_ADDED_LINES=$(git diff -U0 upstream/$BRANCH -- test |grep "^+")
echo "****************-----------------"
echo $TEST_FILE_ADDED_LINES
ENABLE_TO_STATIC_CHECK=`echo "$TEST_FILE_ADDED_LINES" | grep "enable_to_static(" || true`
echo $ENABLE_TO_STATIC_CHECK
echo "****************-----------------"
if [ "${ENABLE_TO_STATIC_CHECK}" != "" ] && [ "${GIT_PR_ID}" != "" ]; then
echo_line="You must have one RD (SigureMo, Aurelius84 or 2742195759) approval for using 'paddle.jit.enable_to_static', we recommend using 'enable_to_static_guard' in the related test files.\n"
check_approval 1 SigureMo Aurelius84 2742195759
fi

HAS_MODIFIED_PHI_FILES=`git diff --name-only upstream/$BRANCH | grep "paddle/phi/" || true`
PHI_INCLUDE_FLUID_FILES=""
for CHANGE_FILE in ${HAS_MODIFIED_PHI_FILES}; do
Expand Down