diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index fb5120c67ce85..a394da6c07b89 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -133,7 +133,8 @@ else() ${PADDLE_BINARY_DIR}/python COMMAND cp -r ${PADDLE_SOURCE_DIR}/test ${PADDLE_BINARY_DIR}/ COMMAND env ${py_env} ${PYTHON_EXECUTABLE} setup.py bdist_wheel - COMMAND ln -sf ${PADDLE_SOURCE_DIR}/python/paddle/jit/PaddleSOT/sot ${PADDLE_BINARY_DIR}/python/paddle/jit/sot + COMMAND ln -sf ${PADDLE_SOURCE_DIR}/python/paddle/jit/PaddleSOT/sot + ${PADDLE_BINARY_DIR}/python/paddle/jit/sot COMMENT "Packing whl packages------>>>" DEPENDS copy_libpaddle ${FLUID_CORE} framework_py_proto profiler_py_proto pass_desc_py_proto ${PY_FILES}) @@ -169,4 +170,4 @@ if(LINUX FATAL_ERROR "patchelf not found, please install it.\n" "For Ubuntu, the command is: apt-get install -y patchelf.") endif() -endif() \ No newline at end of file +endif() diff --git a/test/dygraph_to_static/test_mnist.py b/test/dygraph_to_static/test_mnist.py index f324919e3cc14..2f33516e89dbf 100644 --- a/test/dygraph_to_static/test_mnist.py +++ b/test/dygraph_to_static/test_mnist.py @@ -18,6 +18,7 @@ from time import time import numpy as np +from dygraph_to_static_util import ast_only_test from predictor_utils import PredictorTools import paddle @@ -158,6 +159,7 @@ def train_static(self): def train_dygraph(self): return self.train(to_static=False) + @ast_only_test def test_mnist_to_static(self): dygraph_loss = self.train_dygraph() static_loss = self.train_static() diff --git a/test/dygraph_to_static/test_mobile_net.py b/test/dygraph_to_static/test_mobile_net.py index 7f0efd67620be..f5b99c23cc463 100644 --- a/test/dygraph_to_static/test_mobile_net.py +++ b/test/dygraph_to_static/test_mobile_net.py @@ -19,6 +19,7 @@ import unittest import numpy as np +from dygraph_to_static_util import ast_only_test from predictor_utils import PredictorTools import paddle @@ -713,6 +714,7 @@ def assert_same_predict(self, model_name): ), ) + @ast_only_test def test_mobile_net(self): # MobileNet-V1 self.assert_same_loss("MobileNetV1") diff --git a/test/dygraph_to_static/test_op_attr.py b/test/dygraph_to_static/test_op_attr.py index d474d80b63e60..25194397e4651 100644 --- a/test/dygraph_to_static/test_op_attr.py +++ b/test/dygraph_to_static/test_op_attr.py @@ -14,6 +14,8 @@ import unittest +from dygraph_to_static_util import ast_only_test + import paddle from paddle.static import InputSpec @@ -75,6 +77,7 @@ def expected_results(self): 'elementwise_sub': self.sub_attrs, } + @ast_only_test def test_set_op_attrs(self): net = NetWithOpAttr(self.in_num, self.out_num) # set attrs @@ -116,6 +119,7 @@ def check_op_attrs(self, main_program): else: self.assertEqual(op_val, expect_val) + @ast_only_test def test_set_op_attrs_with_sub_block(self): net = NetWithOpAttr(self.in_num, self.out_num) # set attrs diff --git a/test/dygraph_to_static/test_resnet.py b/test/dygraph_to_static/test_resnet.py index 9fcc1a803f822..2e245b37ef004 100644 --- a/test/dygraph_to_static/test_resnet.py +++ b/test/dygraph_to_static/test_resnet.py @@ -19,6 +19,7 @@ import unittest import numpy as np +from dygraph_to_static_util import ast_only_test from predictor_utils import PredictorTools import paddle @@ -413,6 +414,7 @@ def verify_predict(self): ), ) + @ast_only_test def test_resnet(self): static_loss = self.train(to_static=True) dygraph_loss = self.train(to_static=False) @@ -426,6 +428,7 @@ def test_resnet(self): ) self.verify_predict() + @ast_only_test def test_resnet_composite_backward(self): core._set_prim_backward_enabled(True) static_loss = self.train(to_static=True) @@ -440,6 +443,7 @@ def test_resnet_composite_backward(self): ), ) + @ast_only_test def test_resnet_composite_forward_backward(self): core._set_prim_all_enabled(True) static_loss = self.train(to_static=True) @@ -454,6 +458,7 @@ def test_resnet_composite_forward_backward(self): ), ) + @ast_only_test def test_in_static_mode_mkldnn(self): fluid.set_flags({'FLAGS_use_mkldnn': True}) try: diff --git a/test/dygraph_to_static/test_resnet_v2.py b/test/dygraph_to_static/test_resnet_v2.py index 2efbe46cedfec..943dc6d21ca95 100644 --- a/test/dygraph_to_static/test_resnet_v2.py +++ b/test/dygraph_to_static/test_resnet_v2.py @@ -19,6 +19,7 @@ import unittest import numpy as np +from dygraph_to_static_util import ast_only_test from predictor_utils import PredictorTools import paddle @@ -412,6 +413,7 @@ def verify_predict(self): ), ) + @ast_only_test def test_resnet(self): static_loss = self.train(to_static=True) dygraph_loss = self.train(to_static=False) @@ -425,6 +427,7 @@ def test_resnet(self): ) self.verify_predict() + @ast_only_test def test_resnet_composite(self): core._set_prim_backward_enabled(True) core._add_skip_comp_ops("batch_norm") @@ -440,6 +443,7 @@ def test_resnet_composite(self): ), ) + @ast_only_test def test_in_static_mode_mkldnn(self): paddle.fluid.set_flags({'FLAGS_use_mkldnn': True}) try: diff --git a/test/dygraph_to_static/test_rollback.py b/test/dygraph_to_static/test_rollback.py index c418a850d5aaf..443fffb9d134c 100644 --- a/test/dygraph_to_static/test_rollback.py +++ b/test/dygraph_to_static/test_rollback.py @@ -15,6 +15,7 @@ import unittest import numpy as np +from dygraph_to_static_util import ast_only_test import paddle from paddle.jit.dy2static.program_translator import StaticFunction @@ -88,6 +89,7 @@ class TestRollBackNet(unittest.TestCase): def setUp(self): paddle.set_device("cpu") + @ast_only_test def test_net(self): net = paddle.jit.to_static(Net()) x = paddle.randn([3, 4]) diff --git a/test/dygraph_to_static/test_save_inference_model.py b/test/dygraph_to_static/test_save_inference_model.py index 1d1826c1fd8f6..bacaa59e89b0a 100644 --- a/test/dygraph_to_static/test_save_inference_model.py +++ b/test/dygraph_to_static/test_save_inference_model.py @@ -17,6 +17,7 @@ import unittest import numpy as np +from dygraph_to_static_util import ast_only_test import paddle from paddle import fluid @@ -53,6 +54,7 @@ def setUp(self): def tearDown(self): self.temp_dir.cleanup() + @ast_only_test def test_save_inference_model(self): fc_size = 20 x_data = np.random.random((fc_size, fc_size)).astype('float32') @@ -145,6 +147,7 @@ def load_and_run_inference( class TestPartialProgramRaiseError(unittest.TestCase): + @ast_only_test def test_param_type(self): paddle.jit.enable_to_static(True) x_data = np.random.random((20, 20)).astype('float32') diff --git a/test/dygraph_to_static/test_save_load.py b/test/dygraph_to_static/test_save_load.py index 1f07fe0124502..f02867808d6f5 100644 --- a/test/dygraph_to_static/test_save_load.py +++ b/test/dygraph_to_static/test_save_load.py @@ -17,6 +17,7 @@ import unittest import numpy as np +from dygraph_to_static_util import ast_only_test from test_fetch_feed import Linear import paddle @@ -115,6 +116,7 @@ def test_save_load_same_result(self): dygraph_loss.numpy(), static_loss.numpy(), rtol=1e-05 ) + @ast_only_test def test_save_load_prim(self): with fluid.dygraph.guard(place): self.x = paddle.randn([4, 2, 6, 6], dtype="float32") @@ -155,6 +157,7 @@ def test_save_load_prim(self): self.assertIn("pool2d", load_op_type_list) np.testing.assert_allclose(res.numpy(), new_res.numpy(), rtol=1e-05) + @ast_only_test def test_save_load_prim_with_hook(self): with fluid.dygraph.guard(place): self.x = paddle.randn([4, 2, 6, 6], dtype="float32")