diff --git a/python/paddle/fluid/tests/unittests/white_list/check_op_sequence_instance_0_input_white_list.py b/python/paddle/fluid/tests/unittests/white_list/check_op_sequence_instance_0_input_white_list.py new file mode 100644 index 0000000000000000000000000000000000000000..e5baf7f27457e7b033258ee98f8e295f1efd53be --- /dev/null +++ b/python/paddle/fluid/tests/unittests/white_list/check_op_sequence_instance_0_input_white_list.py @@ -0,0 +1,46 @@ +# 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) diff --git a/tools/check_api_approvals.sh b/tools/check_api_approvals.sh index a8eff9b2283cdb0392ff48d6ec4b8a78d0370076..15f97dc651023dd16088ea826abb830e0eb20096 100644 --- a/tools/check_api_approvals.sh +++ b/tools/check_api_approvals.sh @@ -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/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/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/check_op_sequence_batch_1_input_white_list.py" ) @@ -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 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 + 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 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 diff --git a/tools/check_sequence_op.sh b/tools/check_sequence_op.sh index 9abf8e604a47e58c08b1ba9c18acc0e2489b3b40..c011891f6281ec3eb9a9fa782fd18554d44ac063 100644 --- a/tools/check_sequence_op.sh +++ b/tools/check_sequence_op.sh @@ -36,3 +36,15 @@ if [ "${INVALID_SEQUENCE_OP_UNITTEST}" != "" ]; then echo "************************************" exit 1 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