From cf8e86df35aecae07501e79be358a9ce48b84934 Mon Sep 17 00:00:00 2001 From: Huihuang Zheng Date: Mon, 4 Jul 2022 13:48:42 +0800 Subject: [PATCH] [CINN] Enable test_resnet50_with_cinn (#44017) --- .../fluid/tests/unittests/CMakeLists.txt | 19 +++++++++++++++++++ .../unittests/test_resnet50_with_cinn.py | 4 ++++ 2 files changed, 23 insertions(+) diff --git a/python/paddle/fluid/tests/unittests/CMakeLists.txt b/python/paddle/fluid/tests/unittests/CMakeLists.txt index 6df9c8c426..06bec07d7a 100755 --- a/python/paddle/fluid/tests/unittests/CMakeLists.txt +++ b/python/paddle/fluid/tests/unittests/CMakeLists.txt @@ -1687,3 +1687,22 @@ if($ENV{USE_STANDALONE_EXECUTOR}) set_tests_properties(test_imperative_mnist_sorted_gradient PROPERTIES ENVIRONMENT FLAGS_USE_STANDALONE_EXECUTOR=0) endif() + +if(WITH_CINN AND WITH_TESTING) + set_tests_properties( + test_resnet50_with_cinn + PROPERTIES + LABELS + "RUN_TYPE=CINN" + ENVIRONMENT + FLAGS_allow_cinn_ops="conv2d;conv2d_grad;elementwise_add;elementwise_add_grad;relu;relu_grad;sum" + ) + set_tests_properties( + test_parallel_executor_run_cinn + PROPERTIES + LABELS + "RUN_TYPE=CINN" + ENVIRONMENT + FLAGS_allow_cinn_ops="conv2d;conv2d_grad;elementwise_add;elementwise_add_grad;relu;relu_grad;sum" + ) +endif() diff --git a/python/paddle/fluid/tests/unittests/test_resnet50_with_cinn.py b/python/paddle/fluid/tests/unittests/test_resnet50_with_cinn.py index 829960250d..4aebad4e87 100644 --- a/python/paddle/fluid/tests/unittests/test_resnet50_with_cinn.py +++ b/python/paddle/fluid/tests/unittests/test_resnet50_with_cinn.py @@ -108,6 +108,10 @@ class TestResnet50Accuracy(unittest.TestCase): loss_c = self.train(place, loop_num, feed, use_cinn=True) loss_p = self.train(place, loop_num, feed, use_cinn=False) + print("Losses of CINN:") + print(loss_c) + print("Losses of Paddle") + print(loss_p) self.assertTrue(np.allclose(loss_c, loss_p, atol=1e-5)) -- GitLab