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

OP unit test specification: compiletime-runtime consistency check (#22006)

上级 aa2ed0dc
......@@ -1118,8 +1118,7 @@ class OpTest(unittest.TestCase):
no_check_set=None,
equal_nan=False,
check_dygraph=True,
inplace_atol=None,
check_compile_vs_runtime=True):
inplace_atol=None):
self.__class__.op_type = self.op_type
if hasattr(self, "use_mkldnn"):
self.__class__.use_mkldnn = self.use_mkldnn
......@@ -1131,9 +1130,7 @@ class OpTest(unittest.TestCase):
outs, dygraph_outs, fetch_list = res
else:
outs, fetch_list = res
if check_compile_vs_runtime and (
self.op_type not in
compile_vs_runtime_white_list.COMPILE_RUN_OP_WHITE_LIST):
if 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):
......
......@@ -74,7 +74,7 @@ class TestSequencePadOp(OpTest):
self.compute()
def test_check_output(self):
self.check_output(check_compile_vs_runtime=True, check_dygraph=False)
self.check_output(check_dygraph=False)
def test_check_grad(self):
self.check_grad(["X"], "Out", check_dygraph=False)
......
......@@ -50,7 +50,7 @@ class TestSequenceUnpadOp(OpTest):
self.compute()
def test_check_output(self):
self.check_output(check_compile_vs_runtime=True, check_dygraph=False)
self.check_output(check_dygraph=False)
def test_check_grad(self):
self.check_grad(["X"], "Out", check_dygraph=False)
......
......@@ -71,7 +71,7 @@ class TestMatchMatrixTensorOp(OpTest):
self.outputs = {'Out': (out, out_lod), 'Tmp': tmp}
def test_check_output(self):
self.check_output(check_compile_vs_runtime=True, check_dygraph=False)
self.check_output(check_dygraph=False)
def test_check_grad(self):
self.check_grad(['X', 'Y'], 'Out', check_dygraph=False)
......
......@@ -15,7 +15,9 @@
# 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.
# compiletime&runtime will be skipped. Ops in this whitelist need to declear
# reasons for skipping compile_vs_runtime test or be fixed later.
COMPILE_RUN_OP_WHITE_LIST = [
'lod_reset', 'sequence_pool', 'sequence_slice', 'generate_mask_labels',
'sequence_reshape', 'generate_proposals', 'mine_hard_examples',
......
......@@ -29,6 +29,7 @@ API_FILES=("CMakeLists.txt"
"paddle/fluid/framework/unused_var_check.cc"
"python/paddle/fluid/tests/unittests/white_list/check_shape_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/no_check_set_white_list.py"
)
......@@ -115,6 +116,9 @@ for API_FILE in ${API_FILES[*]}; do
elif [ "${API_FILE}" == "python/paddle/fluid/tests/unittests/white_list/op_accuracy_white_list.py" ];then
echo_line="You must have one RD (juncaipeng (Recommend), zhangting2020 (Recommend) or luotao1) approval for the python/paddle/fluid/tests/unittests/white_list/op_accuracy_white_list.py, which manages the white list of upgrading the precision of op test to float64. For more information, please refer to: https://github.com/PaddlePaddle/Paddle/wiki/Upgrade-OP-Precision-to-Float64. \n"
check_approval 1 52520497 26615455 6836917
elif [ "${API_FILE}" == "python/paddle/fluid/tests/unittests/white_list/compile_vs_runtime_white_list.py" ];then
echo_line="You must have one RD (DannyIsFunny (Recommend), luotao1, phlrain) approval for the python/paddle/fluid/tests/unittests/white_list/compile_vs_runtime_white_list.py, which manages the white list of compile&runtime lod-level check. For more information, please refer to: https://github.com/PaddlePaddle/Paddle/wiki/Compile_vs_Runtime-Check-Specification. \n"
check_approval 1 45189361 6836917 43953930
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
......@@ -179,13 +183,6 @@ 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.
先完成此消息的编辑!
想要评论请 注册