未验证 提交 53c16eab 编写于 作者: H huzhiqiang 提交者: GitHub

test the compatibility between execution time and compiling time (#21511)

* test the equality between running-time and compiling time

* add white_list for compile_vs_runtime check test=develop

* add check of new-registered op on compile&runtime-lodEquality test=develop

* test=develop

* test=develop

* update white-list test=develop

* merge with new code test=develop

* fix code style test=develop

* test=devleop

* test=develop

* test=develop

* test=develop

* add more ops to white_list test=develop

* test=develop

* test=develop

* test=develop

* test=develop

* test=develop

* fix code_style: add comments test=develop

* test=develop
上级 9dff56e8
......@@ -33,7 +33,7 @@ from paddle.fluid.executor import Executor
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, op_check_grad_white_list, check_shape_white_list
from white_list import op_accuracy_white_list, op_check_grad_white_list, check_shape_white_list, compile_vs_runtime_white_list
def _set_use_system_allocator(value=None):
......@@ -1102,7 +1102,7 @@ class OpTest(unittest.TestCase):
equal_nan=False,
check_dygraph=True,
inplace_atol=None,
check_compile_vs_runtime=False):
check_compile_vs_runtime=True):
self.__class__.op_type = self.op_type
places = self._get_places()
for place in places:
......@@ -1112,7 +1112,9 @@ class OpTest(unittest.TestCase):
outs, dygraph_outs, fetch_list = res
else:
outs, fetch_list = res
if check_compile_vs_runtime:
if check_compile_vs_runtime and (
self.op_type not in
compile_vs_runtime_white_list.COMPILE_RUN_OP_WHITE_LIST):
self.check_compile_vs_runtime(fetch_list, outs)
def check_output_customized(self, checker):
......
# Copyright (c) 2018 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 not be required.
COMPILE_RUN_OP_WHITE_LIST = [
'lod_reset', 'sequence_pool', 'sequence_slice', 'generate_mask_labels',
'sequence_reshape', 'generate_proposals', 'mine_hard_examples',
'retinanet_detection_output', 'ctc_align', 'fusion_seqpool_cvm_concat',
'gru', 'sequence_erase', 'rpn_target_assign', 'retinanet_target_assign',
'filter_by_instag', 'fusion_seqpool_concat', 'multiclass_nms',
'multiclass_nms2', 'im2sequence', 'generate_proposal_labels',
'distribute_fpn_proposals', 'detection_map', 'locality_aware_nms',
'var_conv_2d'
]
......@@ -168,6 +168,13 @@ if [ "${HAS_INPLACE_TESTS}" != "" ] && [ "${GIT_PR_ID}" != "" ]; then
check_approval 1 46782768 47554610 43953930 6836917
fi
HAS_COMPILERUNTIME_NOT_TEST=`git diff -U0 --diff-filter=A upstream/$BRANCH |grep "+" |grep -E "check_output[(]*check_compile_vs_runtime=False" || true`
if [ "${HAS_COMPILERUNTIME_NOT_TEST}" != "" ] && [ "${GIT_PR_ID}" != "" ]; then
echo_line="If the operator's output after infershape() is a LodTensor, the output's Lod-Level during compile-time and runtime must be equal. Please set check_compile_vs_runtime=True in op_test.check_output function to enable compile&runtime lod-level check.\n
If you do not need check_compile_vs_runtime, you must have one RD (lanxianghit, phlrain, luotao1) approval.\nThe corresponding lines are as follows:\n${HAS_COMPILERUNTIME_NOT_TEST}\n"
check_approval 1 47554610 43953930 6836917
fi
OP_FILE_CHANGED=`git diff --name-only --diff-filter=AMR upstream/$BRANCH |grep -oE ".+_op..*" || true`
if [ "${OP_FILE_CHANGED}" != "" ] && [ "${GIT_PR_ID}" != "" ]; then
for OP_FILE in ${OP_FILE_CHANGED};
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册