From ed5f9841af1f7106b97114cddff77c652e7dcb6f Mon Sep 17 00:00:00 2001 From: zhaoyang-star Date: Thu, 30 Dec 2021 13:36:40 +0800 Subject: [PATCH 1/4] [OpTestPy] support opencl on elementwise_pow test=document_fix --- lite/tests/unittest_py/op/test_elementwise_pow_op.py | 9 +++++---- lite/tests/unittest_py/op/test_elementwise_sub_op.py | 2 +- tools/ci_tools/ci_autoscan_arm.sh | 3 +++ 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/lite/tests/unittest_py/op/test_elementwise_pow_op.py b/lite/tests/unittest_py/op/test_elementwise_pow_op.py index d5d68b772c7..6b2217afd1d 100644 --- a/lite/tests/unittest_py/op/test_elementwise_pow_op.py +++ b/lite/tests/unittest_py/op/test_elementwise_pow_op.py @@ -80,11 +80,11 @@ def sample_program_configs(self, draw): input_data_x_shape = draw( st.lists( st.integers( - min_value=1, max_value=20), min_size=1, max_size=4)) + min_value=1, max_value=20), min_size=4, max_size=4)) input_data_y_shape = draw( st.lists( st.integers( - min_value=1, max_value=20), min_size=1, max_size=4)) + min_value=1, max_value=20), min_size=4, max_size=4)) axis = draw(st.integers(min_value=-1, max_value=4)) assume( check_broadcast(input_data_x_shape, input_data_y_shape, axis) == @@ -104,8 +104,9 @@ def sample_program_configs(self, draw): input_data_type = draw(st.sampled_from([np.float32])) def gen_input_data(*args, **kwargs): + # The value is small because we do pow operation. The result will be very large if input data is large. return np.random.randint( - 1, 20, size=(kwargs['shape'])).astype(kwargs['dtype']) + 1, 5, size=(kwargs['shape'])).astype(kwargs['dtype']) elementwise_pow_op = OpConfig( type="elementwise_pow", @@ -134,7 +135,7 @@ def sample_predictor_configs(self): def add_ignore_pass_case(self): def teller1(program_config, predictor_config): - return True + return False self.add_ignore_check_case( teller1, IgnoreReasons.ACCURACY_ERROR, diff --git a/lite/tests/unittest_py/op/test_elementwise_sub_op.py b/lite/tests/unittest_py/op/test_elementwise_sub_op.py index dc215309146..4f066431972 100644 --- a/lite/tests/unittest_py/op/test_elementwise_sub_op.py +++ b/lite/tests/unittest_py/op/test_elementwise_sub_op.py @@ -141,7 +141,7 @@ def teller1(program_config, predictor_config): self.add_ignore_check_case( teller1, IgnoreReasons.PADDLELITE_NOT_SUPPORT, - "The elementwise_min op's result is different from paddle in some case, we should fix it as soon as possible!" + "The elementwise_sub op's result is different from paddle in some case, we should fix it as soon as possible!" ) def test(self, *args, **kwargs): diff --git a/tools/ci_tools/ci_autoscan_arm.sh b/tools/ci_tools/ci_autoscan_arm.sh index 0d76a090b66..85d2fd2528b 100755 --- a/tools/ci_tools/ci_autoscan_arm.sh +++ b/tools/ci_tools/ci_autoscan_arm.sh @@ -112,7 +112,9 @@ function run_test() { for target in ${targets[@]}; do auto_scan_test $target done +} +function get_summary() { cd $WORKSPACE/lite/tests/unittest_py/op/ python3.8 ../global_var_model.py cd $WORKSPACE/lite/tests/unittest_py/pass/ @@ -151,6 +153,7 @@ function main() { done pipeline $TARGET_LIST + get_summary echo "Success for targets:" $TARGET_LIST } From 978b66c846848997cf455a6ccb714e07062d7dde Mon Sep 17 00:00:00 2001 From: zhaoyang-star Date: Thu, 30 Dec 2021 13:56:48 +0800 Subject: [PATCH 2/4] [OpTestPy] support opencl on elementwise_pow test=document_fix --- lite/tests/unittest_py/op/test_elementwise_pow_op.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lite/tests/unittest_py/op/test_elementwise_pow_op.py b/lite/tests/unittest_py/op/test_elementwise_pow_op.py index 6b2217afd1d..d5d2997bbbe 100644 --- a/lite/tests/unittest_py/op/test_elementwise_pow_op.py +++ b/lite/tests/unittest_py/op/test_elementwise_pow_op.py @@ -80,11 +80,11 @@ def sample_program_configs(self, draw): input_data_x_shape = draw( st.lists( st.integers( - min_value=1, max_value=20), min_size=4, max_size=4)) + min_value=1, max_value=20), min_size=1, max_size=4)) input_data_y_shape = draw( st.lists( st.integers( - min_value=1, max_value=20), min_size=4, max_size=4)) + min_value=1, max_value=20), min_size=1, max_size=4)) axis = draw(st.integers(min_value=-1, max_value=4)) assume( check_broadcast(input_data_x_shape, input_data_y_shape, axis) == @@ -135,11 +135,14 @@ def sample_predictor_configs(self): def add_ignore_pass_case(self): def teller1(program_config, predictor_config): + input_data_shape = program_config.inputs["input_data_x"].shape + if len(input_data_shape) != 4: + return True return False self.add_ignore_check_case( teller1, IgnoreReasons.ACCURACY_ERROR, - "The elementwise_pow op's result is different from paddle, because paddle has bug on this op, wait paddle fix!" + "The elementwise_pow op's result is different from paddle, we should fix it as soon as possible!" ) def test(self, *args, **kwargs): From 5bd25a2757e03a43a73395fad9349c727f47827d Mon Sep 17 00:00:00 2001 From: zhaoyang-star Date: Thu, 30 Dec 2021 15:55:23 +0800 Subject: [PATCH 3/4] [OpTestPy] support opencl on elementwise_pow test=document_fix --- tools/ci_tools/ci_autoscan_x86.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/ci_tools/ci_autoscan_x86.sh b/tools/ci_tools/ci_autoscan_x86.sh index f03933e3fb9..77233684e7f 100755 --- a/tools/ci_tools/ci_autoscan_x86.sh +++ b/tools/ci_tools/ci_autoscan_x86.sh @@ -82,7 +82,9 @@ function run_test() { for target in ${targets[@]}; do auto_scan_test $target done +} +function get_summary() { cd $WORKSPACE/lite/tests/unittest_py/op/ python$PYTHON_VERSION ../global_var_model.py cd $WORKSPACE/lite/tests/unittest_py/pass/ @@ -116,6 +118,7 @@ function main() { done pipeline + get_summary echo "Success for targets: Host,X86" } From bb8fc06b58532496fee21cb47c12e764884f9453 Mon Sep 17 00:00:00 2001 From: zhaoyang-star Date: Thu, 30 Dec 2021 16:19:53 +0800 Subject: [PATCH 4/4] [OpTestPy] support opencl on elementwise_pow test=document_fix --- docs/performance/benchmark_tools.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/performance/benchmark_tools.md b/docs/performance/benchmark_tools.md index 99cfee5bf1c..0b5d60a9ace 100644 --- a/docs/performance/benchmark_tools.md +++ b/docs/performance/benchmark_tools.md @@ -386,7 +386,7 @@ adb shell "cd /data/local/tmp/benchmark; --input_shape=1,3,224,224 \ --warmup=10 \ --repeats=20 \ - --backend=opemncl,arm \ + --backend=opencl,arm \ --opencl_cache_dir=/data/local/tmp \ --opencl_kernel_cache_file=MobileNetV1_kernel.bin \ --opencl_tuned_file=MobileNetV1_tuned.bin"