提交 e31f8a2f 编写于 作者: Z zhongpu 提交者: Tao Luo

add CI check for sequence ops' unittests (#22221)

上级 d3a66473
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserve
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# If the output after infershape() is a lod_tensor, commenly its lod_level
# should be equal during compile time and run time.
# For ops in this whitelist, the equality check of lod_level between
# compiletime&runtime will be skipped. Ops in this whitelist need to declear
# reasons for skipping compile_vs_runtime test or be fixed later.
#!/usr/bin/env python
from __future__ import print_function
import sys
# For ops in this whitelist, the check of instance size is 0 input will be skipped.
# Ops in this whitelist need to be fixed later.
NEED_TO_FIX_OP_LIST = [
'sequence_concat',
'sequence_conv',
'sequence_enumerate',
'sequence_erase',
'sequence_expand_as',
'sequence_expand',
'sequence_mask',
'sequence_pad',
'sequence_reshape',
'sequence_reverse',
'sequence_scatter',
'sequence_slice',
'sequence_softmax',
'sequence_topk_avg_pooling',
'sequence_unpad',
]
op_name = sys.argv[1]
print(op_name in NEED_TO_FIX_OP_LIST)
...@@ -31,6 +31,7 @@ API_FILES=("CMakeLists.txt" ...@@ -31,6 +31,7 @@ API_FILES=("CMakeLists.txt"
"python/paddle/fluid/tests/unittests/white_list/op_accuracy_white_list.py" "python/paddle/fluid/tests/unittests/white_list/op_accuracy_white_list.py"
"python/paddle/fluid/tests/unittests/white_list/compile_vs_runtime_white_list.py" "python/paddle/fluid/tests/unittests/white_list/compile_vs_runtime_white_list.py"
"python/paddle/fluid/tests/unittests/white_list/no_check_set_white_list.py" "python/paddle/fluid/tests/unittests/white_list/no_check_set_white_list.py"
"python/paddle/fluid/tests/unittests/white_list/check_op_sequence_instance_0_input_white_list.py"
"python/paddle/fluid/tests/unittests/white_list/op_threshold_white_list.py" "python/paddle/fluid/tests/unittests/white_list/op_threshold_white_list.py"
"python/paddle/fluid/tests/unittests/white_list/check_op_sequence_batch_1_input_white_list.py" "python/paddle/fluid/tests/unittests/white_list/check_op_sequence_batch_1_input_white_list.py"
) )
...@@ -124,6 +125,9 @@ for API_FILE in ${API_FILES[*]}; do ...@@ -124,6 +125,9 @@ for API_FILE in ${API_FILES[*]}; do
elif [ "${API_FILE}" == "python/paddle/fluid/tests/unittests/white_list/no_check_set_white_list.py" ];then elif [ "${API_FILE}" == "python/paddle/fluid/tests/unittests/white_list/no_check_set_white_list.py" ];then
echo_line="You must have one RD (cryoco (Recommend), luotao1 or phlrain) approval for the python/paddle/fluid/tests/unittests/white_list/no_check_set_white_list.py, which manages the white list of setting no_check_set of check_output. \n" echo_line="You must have one RD (cryoco (Recommend), luotao1 or phlrain) approval for the python/paddle/fluid/tests/unittests/white_list/no_check_set_white_list.py, which manages the white list of setting no_check_set of check_output. \n"
check_approval 1 12407750 26615455 6836917 check_approval 1 12407750 26615455 6836917
elif [ "${API_FILE}" == "python/paddle/fluid/tests/unittests/white_list/check_op_sequence_instance_0_input_white_list.py" ]; then
echo_line="You must have one RD (JepsonWong (Recommend), luotao1, phlrain) approval for the ${API_FILE}, which manages the white list of instance size 0 input for sequence op test. For more information, please refer to [https://github.com/PaddlePaddle/Paddle/wiki/It-is-required-to-include-LoDTensor-input-with-instance_size=0-in-sequence-OP-test]. \n"
check_approval 1 16509038 6836917 43953930
elif [ "${API_FILE}" == "python/paddle/fluid/tests/unittests/white_list/op_threshold_white_list.py" ];then elif [ "${API_FILE}" == "python/paddle/fluid/tests/unittests/white_list/op_threshold_white_list.py" ];then
echo_line="It is an Op accuracy problem, please take care of it. You must have one RD (juncaipeng (Recommend), zhangting2020 or luotao1) approval for the python/paddle/fluid/tests/unittests/white_list/op_threshold_white_list.py, which manages the white list of error threshold for op test with float64 precision. For more information, please refer to: https://github.com/PaddlePaddle/Paddle/wiki/Upgrade-OP-Precision-to-Float64. \n" echo_line="It is an Op accuracy problem, please take care of it. You must have one RD (juncaipeng (Recommend), zhangting2020 or luotao1) approval for the python/paddle/fluid/tests/unittests/white_list/op_threshold_white_list.py, which manages the white list of error threshold for op test with float64 precision. For more information, please refer to: https://github.com/PaddlePaddle/Paddle/wiki/Upgrade-OP-Precision-to-Float64. \n"
check_approval 1 52520497 26615455 6836917 check_approval 1 52520497 26615455 6836917
......
...@@ -36,3 +36,15 @@ if [ "${INVALID_SEQUENCE_OP_UNITTEST}" != "" ]; then ...@@ -36,3 +36,15 @@ if [ "${INVALID_SEQUENCE_OP_UNITTEST}" != "" ]; then
echo "************************************" echo "************************************"
exit 1 exit 1
fi fi
check_white_list_file="python/paddle/fluid/tests/unittests/white_list/check_op_sequence_instance_0_input_white_list.py"
function_grep="self.get_sequence_instance_size_0_input("
INVALID_SEQUENCE_OP_UNITTEST=$(check_sequnece_op_unitests ${check_white_list_file} ${function_grep})
if [ "${INVALID_SEQUENCE_OP_UNITTEST}" != "" ]; then
echo "************************************"
echo -e "It is required to include instance size 0 LoDTensor input in sequence OP test, please use self.get_sequence_instance_size_0_input() method."
echo -e "For more information, please refer to [https://github.com/PaddlePaddle/Paddle/wiki/It-is-required-to-include-LoDTensor-input-with-instance_size=0-in-sequence-OP-test]. "
echo -e "Please check the following unittest files:\n${INVALID_SEQUENCE_OP_UNITTEST}"
echo "************************************"
exit 1
fi
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册