未验证 提交 a392b777 编写于 作者: 石晓伟 提交者: GitHub

add no_grad_set value check in op_test, test=develop (#22370)

* add no_grad_set value check in op_test, test=develop

* update ops list, test=develop
上级 8f36c395
......@@ -34,7 +34,7 @@ from paddle.fluid.framework import Program, OpProtoHolder, Variable
from testsuite import create_op, set_input, append_input_output, append_loss_ops
from paddle.fluid import unique_name
from white_list import op_accuracy_white_list, check_shape_white_list, compile_vs_runtime_white_list, no_check_set_white_list
from white_list import op_threshold_white_list
from white_list import op_threshold_white_list, no_grad_set_white_list
def _set_use_system_allocator(value=None):
......@@ -1298,6 +1298,12 @@ class OpTest(unittest.TestCase):
if no_grad_set is None:
no_grad_set = set()
else:
if (self.op_type not in no_grad_set_white_list.NEED_TO_FIX_OP_LIST
) and (self.op_type not in
no_grad_set_white_list.NOT_CHECK_OP_LIST):
raise AssertionError("no_grad_set must be None, op_type is " +
self.op_type + " Op.")
if not type(output_names) is list:
output_names = [output_names]
......
# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved.
#
# 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.
# check no_grad_set is None
NOT_CHECK_OP_LIST = []
# TODO(Shixiaowei02): Check if the items do not need fix.
# no_grad_set has value in NEED_TO_FIX_OP_LIST
# yapf: disable
NEED_TO_FIX_OP_LIST = [
'affine_channel',
'affine_grid',
'backward',
'batch_norm',
'conv_shift',
'conv2d',
'conv2d_transpose',
'conv3d',
'conv3d_transpose',
'cos_sim',
'cross_entropy',
'cross_entropy2',
'data_norm',
'deformable_conv',
'deformable_conv_v1',
'depthwise_conv2d',
'depthwise_conv2d_transpose',
'elementwise_add',
'elementwise_div',
'elementwise_max',
'elementwise_min',
'elementwise_mul',
'elementwise_sub',
'filter_by_instag',
'fused_elemwise_activation',
'fused_emb_seq_pool',
'fused_embedding_seq_pool',
'gru_unit',
'hierarchical_sigmoid',
'hsigmoid',
'huber_loss',
'instance_norm',
'kldiv_loss',
'linear_chain_crf',
'lod_reset',
'lookup_table',
'lookup_table_v2',
'lstm',
'lstmp',
'margin_rank_loss',
'matmul',
'mul',
'multiplex',
'prelu',
'rank_loss',
'row_conv',
'sequence_conv',
'smooth_l1_loss',
'spectral_norm'
]
# yapf: enable
......@@ -33,6 +33,7 @@ API_FILES=("CMakeLists.txt"
"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"
"python/paddle/fluid/tests/unittests/white_list/no_grad_set_white_list.py"
)
approval_line=`curl -H "Authorization: token ${GITHUB_API_TOKEN}" https://api.github.com/repos/PaddlePaddle/Paddle/pulls/${GIT_PR_ID}/reviews?per_page=10000`
......@@ -93,7 +94,7 @@ for API_FILE in ${API_FILES[*]}; do
if [ "${API_CHANGE}" ] && [ "${GIT_PR_ID}" != "" ]; then
# NOTE: per_page=10000 should be ok for all cases, a PR review > 10000 is not human readable.
# You can use http://caius.github.io/github_id/ to find Github user id.
# approval_user_list: XiaoguangHu01 46782768,Xreki 12538138,luotao1 6836917,sneaxiy 32832641,qingqing01 7845005,guoshengCS 14105589,heavengate 12605721,kuke 3064195,Superjomn 328693,lanxianghit 47554610,cyj1986 39645414,hutuxian 11195205,frankwhzhang 20274488,nepeplwu 45024560,Dianhai 38231817,chenwhql 22561442,zhiqiu 6888866,seiriosPlus 5442383,gongweibao 10721757,saxon-zh 2870059,Boyan-Liu 31623103, zhouwei25 52485244, Aurelius84 9301846, liym27 33742067, zhhsplendid 7913861, kolinwei 22165420, liuwei1031 46661762, swtkiwi 27208573, juncaipeng 52520497, zhangting2020 26615455, JepsonWong 16509038.
# approval_user_list: XiaoguangHu01 46782768,Xreki 12538138,luotao1 6836917,sneaxiy 32832641,qingqing01 7845005,guoshengCS 14105589,heavengate 12605721,kuke 3064195,Superjomn 328693,lanxianghit 47554610,cyj1986 39645414,hutuxian 11195205,frankwhzhang 20274488,nepeplwu 45024560,Dianhai 38231817,chenwhql 22561442,zhiqiu 6888866,seiriosPlus 5442383,gongweibao 10721757,saxon-zh 2870059,Boyan-Liu 31623103, zhouwei25 52485244, Aurelius84 9301846, liym27 33742067, zhhsplendid 7913861, kolinwei 22165420, liuwei1031 46661762, swtkiwi 27208573, juncaipeng 52520497, zhangting2020 26615455, JepsonWong 16509038, Shixiaowei02 39303645.
if [ "${API_FILE}" == "CMakeLists.txt" ];then
echo_line="You must have one RD (luotao1 or XiaoguangHu01) approval for CMakeLists.txt, which manages the compilation parameter.\n"
check_approval 1 6836917 46782768
......@@ -130,6 +131,9 @@ for API_FILE in ${API_FILES[*]}; do
elif [ "${API_FILE}" == "python/paddle/fluid/tests/unittests/white_list/check_op_sequence_batch_1_input_white_list.py" ];then
echo_line="You must have one RD (songyouwei, luotao1 or phlrain) approval for ${API_FILE}, which manages the white list of batch size 1 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-batch_size=1-in-sequence-OP-test]. \n"
check_approval 1 2573291 6836917 43953930
elif [ "${API_FILE}" == "python/paddle/fluid/tests/unittests/white_list/no_grad_set_white_list.py" ];then
echo_line="You must have one RD (Shixiaowei02 (Recommend), luotao1 or phlrain) approval for the python/paddle/fluid/tests/unittests/white_list/no_grad_set_white_list.py, which manages the white list of no_grad_set without value in operators.\n"
check_approval 1 39303645 6836917 43953930
else
echo_line="It is an Op accuracy problem, please take care of it. You must have one RD (XiaoguangHu01,Xreki,luotao1,sneaxiy) approval for ${API_FILE}, which manages the underlying code for fluid.\n"
check_approval 1 3048612 46782768 12538138 6836917 32832641
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册