From 78ec51cd3c9bdcda9814b333fe8c574b5d1cb4bc Mon Sep 17 00:00:00 2001 From: tianshuo78520a <707759223@qq.com> Date: Wed, 19 Apr 2023 15:09:54 +0800 Subject: [PATCH] Mv sequence dir (#52985) * mv sequence tests * mv sequence tests * fix test error * fix --- python/paddle/fluid/tests/unittests/CMakeLists.txt | 2 -- .../tests/unittests/test_fusion_seqconv_eltadd_relu_op.py | 5 ++++- .../fluid/tests/unittests/test_fusion_seqpool_concat_op.py | 5 ++++- .../tests/unittests/test_fusion_seqpool_cvm_concat_op.py | 7 +++++-- test/CMakeLists.txt | 2 +- .../fluid/tests/unittests => test}/sequence/CMakeLists.txt | 0 .../fluid/tests/unittests => test}/sequence/__init__.py | 0 .../unittests => test}/sequence/test_sequence_concat.py | 2 +- .../unittests => test}/sequence/test_sequence_conv.py | 2 +- .../sequence/test_sequence_enumerate_op.py | 2 +- .../unittests => test}/sequence/test_sequence_erase_op.py | 2 +- .../unittests => test}/sequence/test_sequence_expand.py | 2 +- .../unittests => test}/sequence/test_sequence_expand_as.py | 2 +- .../sequence/test_sequence_first_step.py | 0 .../unittests => test}/sequence/test_sequence_last_step.py | 0 .../unittests => test}/sequence/test_sequence_mask.py | 2 +- .../unittests => test}/sequence/test_sequence_pad_op.py | 2 +- .../unittests => test}/sequence/test_sequence_pool.py | 2 +- .../unittests => test}/sequence/test_sequence_reshape.py | 2 +- .../unittests => test}/sequence/test_sequence_reverse.py | 2 +- .../sequence/test_sequence_scatter_op.py | 2 +- .../unittests => test}/sequence/test_sequence_slice_op.py | 2 +- .../sequence/test_sequence_softmax_op.py | 2 +- .../sequence/test_sequence_topk_avg_pooling.py | 2 +- .../unittests => test}/sequence/test_sequence_unpad_op.py | 2 +- 25 files changed, 30 insertions(+), 23 deletions(-) rename {python/paddle/fluid/tests/unittests => test}/sequence/CMakeLists.txt (100%) rename {python/paddle/fluid/tests/unittests => test}/sequence/__init__.py (100%) rename {python/paddle/fluid/tests/unittests => test}/sequence/test_sequence_concat.py (98%) rename {python/paddle/fluid/tests/unittests => test}/sequence/test_sequence_conv.py (99%) rename {python/paddle/fluid/tests/unittests => test}/sequence/test_sequence_enumerate_op.py (98%) rename {python/paddle/fluid/tests/unittests => test}/sequence/test_sequence_erase_op.py (98%) rename {python/paddle/fluid/tests/unittests => test}/sequence/test_sequence_expand.py (98%) rename {python/paddle/fluid/tests/unittests => test}/sequence/test_sequence_expand_as.py (98%) rename {python/paddle/fluid/tests/unittests => test}/sequence/test_sequence_first_step.py (100%) rename {python/paddle/fluid/tests/unittests => test}/sequence/test_sequence_last_step.py (100%) rename {python/paddle/fluid/tests/unittests => test}/sequence/test_sequence_mask.py (98%) rename {python/paddle/fluid/tests/unittests => test}/sequence/test_sequence_pad_op.py (99%) rename {python/paddle/fluid/tests/unittests => test}/sequence/test_sequence_pool.py (99%) rename {python/paddle/fluid/tests/unittests => test}/sequence/test_sequence_reshape.py (98%) rename {python/paddle/fluid/tests/unittests => test}/sequence/test_sequence_reverse.py (98%) rename {python/paddle/fluid/tests/unittests => test}/sequence/test_sequence_scatter_op.py (97%) rename {python/paddle/fluid/tests/unittests => test}/sequence/test_sequence_slice_op.py (97%) rename {python/paddle/fluid/tests/unittests => test}/sequence/test_sequence_softmax_op.py (97%) rename {python/paddle/fluid/tests/unittests => test}/sequence/test_sequence_topk_avg_pooling.py (99%) rename {python/paddle/fluid/tests/unittests => test}/sequence/test_sequence_unpad_op.py (98%) diff --git a/python/paddle/fluid/tests/unittests/CMakeLists.txt b/python/paddle/fluid/tests/unittests/CMakeLists.txt index 39739b742ac..406b8d5f55b 100755 --- a/python/paddle/fluid/tests/unittests/CMakeLists.txt +++ b/python/paddle/fluid/tests/unittests/CMakeLists.txt @@ -765,8 +765,6 @@ if(NOT WIN32) test_ir_memory_optimize_transformer) endif() -add_subdirectory(sequence) - # dist xpu tests: if(WITH_XPU_BKCL) py_test(test_collective_allreduce_api_xpu diff --git a/python/paddle/fluid/tests/unittests/test_fusion_seqconv_eltadd_relu_op.py b/python/paddle/fluid/tests/unittests/test_fusion_seqconv_eltadd_relu_op.py index 649f6afd0e5..673a709ec05 100644 --- a/python/paddle/fluid/tests/unittests/test_fusion_seqconv_eltadd_relu_op.py +++ b/python/paddle/fluid/tests/unittests/test_fusion_seqconv_eltadd_relu_op.py @@ -12,11 +12,14 @@ # See the License for the specific language governing permissions and # limitations under the License. +import sys import unittest import numpy as np from eager_op_test import OpTest -from sequence.test_sequence_conv import seqconv + +sys.path.append("../../../../../test/sequence") +from test_sequence_conv import seqconv class TestSeqConvEltAddRelu(OpTest): diff --git a/python/paddle/fluid/tests/unittests/test_fusion_seqpool_concat_op.py b/python/paddle/fluid/tests/unittests/test_fusion_seqpool_concat_op.py index 56ce20a76c0..e432500eecf 100644 --- a/python/paddle/fluid/tests/unittests/test_fusion_seqpool_concat_op.py +++ b/python/paddle/fluid/tests/unittests/test_fusion_seqpool_concat_op.py @@ -12,11 +12,14 @@ # See the License for the specific language governing permissions and # limitations under the License. +import sys import unittest import numpy as np from eager_op_test import OpTest -from sequence.test_sequence_pool import ( + +sys.path.append("../../../../../test/sequence") +from test_sequence_pool import ( compute_seqpool_avg, compute_seqpool_sqrt, compute_seqpool_sum, diff --git a/python/paddle/fluid/tests/unittests/test_fusion_seqpool_cvm_concat_op.py b/python/paddle/fluid/tests/unittests/test_fusion_seqpool_cvm_concat_op.py index a5d2eb5c832..39b1f758b14 100644 --- a/python/paddle/fluid/tests/unittests/test_fusion_seqpool_cvm_concat_op.py +++ b/python/paddle/fluid/tests/unittests/test_fusion_seqpool_cvm_concat_op.py @@ -12,16 +12,19 @@ # See the License for the specific language governing permissions and # limitations under the License. +import sys import unittest import numpy as np from eager_op_test import OpTest -from sequence.test_sequence_pool import ( + +sys.path.append("../../../../../test/sequence") +from test_cvm_op import cvm_compute +from test_sequence_pool import ( compute_seqpool_avg, compute_seqpool_sqrt, compute_seqpool_sum, ) -from test_cvm_op import cvm_compute def convert_to_offset(lod): diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 7a5bfae6e20..066875945a7 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -126,7 +126,7 @@ if(WITH_TESTING) add_subdirectory(quantization) add_subdirectory(rnn) add_subdirectory(rpc) - # add_subdirectory(sequence) + add_subdirectory(sequence) add_subdirectory(standalone_executor) add_subdirectory(tokenizer) # add_subdirectory(white_list) diff --git a/python/paddle/fluid/tests/unittests/sequence/CMakeLists.txt b/test/sequence/CMakeLists.txt similarity index 100% rename from python/paddle/fluid/tests/unittests/sequence/CMakeLists.txt rename to test/sequence/CMakeLists.txt diff --git a/python/paddle/fluid/tests/unittests/sequence/__init__.py b/test/sequence/__init__.py similarity index 100% rename from python/paddle/fluid/tests/unittests/sequence/__init__.py rename to test/sequence/__init__.py diff --git a/python/paddle/fluid/tests/unittests/sequence/test_sequence_concat.py b/test/sequence/test_sequence_concat.py similarity index 98% rename from python/paddle/fluid/tests/unittests/sequence/test_sequence_concat.py rename to test/sequence/test_sequence_concat.py index 1227fb0ba4b..91e7df6f472 100644 --- a/python/paddle/fluid/tests/unittests/sequence/test_sequence_concat.py +++ b/test/sequence/test_sequence_concat.py @@ -17,7 +17,7 @@ import unittest import numpy as np -sys.path.append("../") +sys.path.append("../../python/paddle/fluid/tests/unittests") from eager_op_test import OpTest import paddle diff --git a/python/paddle/fluid/tests/unittests/sequence/test_sequence_conv.py b/test/sequence/test_sequence_conv.py similarity index 99% rename from python/paddle/fluid/tests/unittests/sequence/test_sequence_conv.py rename to test/sequence/test_sequence_conv.py index 99d8cc5a9cc..74260ef7ba0 100644 --- a/python/paddle/fluid/tests/unittests/sequence/test_sequence_conv.py +++ b/test/sequence/test_sequence_conv.py @@ -20,7 +20,7 @@ import numpy as np import paddle -sys.path.append("../") +sys.path.append("../../python/paddle/fluid/tests/unittests") from eager_op_test import OpTest diff --git a/python/paddle/fluid/tests/unittests/sequence/test_sequence_enumerate_op.py b/test/sequence/test_sequence_enumerate_op.py similarity index 98% rename from python/paddle/fluid/tests/unittests/sequence/test_sequence_enumerate_op.py rename to test/sequence/test_sequence_enumerate_op.py index 068eacb6e0f..b17a14f47e1 100644 --- a/python/paddle/fluid/tests/unittests/sequence/test_sequence_enumerate_op.py +++ b/test/sequence/test_sequence_enumerate_op.py @@ -17,7 +17,7 @@ import unittest import numpy as np -sys.path.append("../") +sys.path.append("../../python/paddle/fluid/tests/unittests") from eager_op_test import OpTest diff --git a/python/paddle/fluid/tests/unittests/sequence/test_sequence_erase_op.py b/test/sequence/test_sequence_erase_op.py similarity index 98% rename from python/paddle/fluid/tests/unittests/sequence/test_sequence_erase_op.py rename to test/sequence/test_sequence_erase_op.py index 9aaecd1e079..c43f377b761 100644 --- a/python/paddle/fluid/tests/unittests/sequence/test_sequence_erase_op.py +++ b/test/sequence/test_sequence_erase_op.py @@ -17,7 +17,7 @@ import unittest import numpy as np -sys.path.append("../") +sys.path.append("../../python/paddle/fluid/tests/unittests") from eager_op_test import OpTest diff --git a/python/paddle/fluid/tests/unittests/sequence/test_sequence_expand.py b/test/sequence/test_sequence_expand.py similarity index 98% rename from python/paddle/fluid/tests/unittests/sequence/test_sequence_expand.py rename to test/sequence/test_sequence_expand.py index 83291c78130..8f6e86e49a8 100644 --- a/python/paddle/fluid/tests/unittests/sequence/test_sequence_expand.py +++ b/test/sequence/test_sequence_expand.py @@ -17,7 +17,7 @@ import unittest import numpy as np -sys.path.append("../") +sys.path.append("../../python/paddle/fluid/tests/unittests") from eager_op_test import OpTest diff --git a/python/paddle/fluid/tests/unittests/sequence/test_sequence_expand_as.py b/test/sequence/test_sequence_expand_as.py similarity index 98% rename from python/paddle/fluid/tests/unittests/sequence/test_sequence_expand_as.py rename to test/sequence/test_sequence_expand_as.py index 36704f61dcd..e00e393dc6b 100644 --- a/python/paddle/fluid/tests/unittests/sequence/test_sequence_expand_as.py +++ b/test/sequence/test_sequence_expand_as.py @@ -17,7 +17,7 @@ import unittest import numpy as np -sys.path.append("../") +sys.path.append("../../python/paddle/fluid/tests/unittests") from eager_op_test import OpTest import paddle diff --git a/python/paddle/fluid/tests/unittests/sequence/test_sequence_first_step.py b/test/sequence/test_sequence_first_step.py similarity index 100% rename from python/paddle/fluid/tests/unittests/sequence/test_sequence_first_step.py rename to test/sequence/test_sequence_first_step.py diff --git a/python/paddle/fluid/tests/unittests/sequence/test_sequence_last_step.py b/test/sequence/test_sequence_last_step.py similarity index 100% rename from python/paddle/fluid/tests/unittests/sequence/test_sequence_last_step.py rename to test/sequence/test_sequence_last_step.py diff --git a/python/paddle/fluid/tests/unittests/sequence/test_sequence_mask.py b/test/sequence/test_sequence_mask.py similarity index 98% rename from python/paddle/fluid/tests/unittests/sequence/test_sequence_mask.py rename to test/sequence/test_sequence_mask.py index 5e7c79ac0d6..0d2174d5dbc 100644 --- a/python/paddle/fluid/tests/unittests/sequence/test_sequence_mask.py +++ b/test/sequence/test_sequence_mask.py @@ -24,7 +24,7 @@ from paddle.fluid.framework import ( program_guard, ) -sys.path.append("../") +sys.path.append("../../python/paddle/fluid/tests/unittests") from eager_op_test import OpTest diff --git a/python/paddle/fluid/tests/unittests/sequence/test_sequence_pad_op.py b/test/sequence/test_sequence_pad_op.py similarity index 99% rename from python/paddle/fluid/tests/unittests/sequence/test_sequence_pad_op.py rename to test/sequence/test_sequence_pad_op.py index 9bdaba6cbe8..66485c065aa 100644 --- a/python/paddle/fluid/tests/unittests/sequence/test_sequence_pad_op.py +++ b/test/sequence/test_sequence_pad_op.py @@ -17,7 +17,7 @@ import unittest import numpy as np -sys.path.append("../") +sys.path.append("../../python/paddle/fluid/tests/unittests") from eager_op_test import OpTest import paddle diff --git a/python/paddle/fluid/tests/unittests/sequence/test_sequence_pool.py b/test/sequence/test_sequence_pool.py similarity index 99% rename from python/paddle/fluid/tests/unittests/sequence/test_sequence_pool.py rename to test/sequence/test_sequence_pool.py index 5bbca01cdde..a6f345dbcfe 100644 --- a/python/paddle/fluid/tests/unittests/sequence/test_sequence_pool.py +++ b/test/sequence/test_sequence_pool.py @@ -19,7 +19,7 @@ import numpy as np import paddle -sys.path.append("../") +sys.path.append("../../python/paddle/fluid/tests/unittests") from eager_op_test import OpTest, skip_check_grad_ci paddle.enable_static() diff --git a/python/paddle/fluid/tests/unittests/sequence/test_sequence_reshape.py b/test/sequence/test_sequence_reshape.py similarity index 98% rename from python/paddle/fluid/tests/unittests/sequence/test_sequence_reshape.py rename to test/sequence/test_sequence_reshape.py index 4f6005d83c8..cf4266982b3 100644 --- a/python/paddle/fluid/tests/unittests/sequence/test_sequence_reshape.py +++ b/test/sequence/test_sequence_reshape.py @@ -19,7 +19,7 @@ import numpy as np import paddle -sys.path.append("../") +sys.path.append("../../python/paddle/fluid/tests/unittests") from eager_op_test import OpTest diff --git a/python/paddle/fluid/tests/unittests/sequence/test_sequence_reverse.py b/test/sequence/test_sequence_reverse.py similarity index 98% rename from python/paddle/fluid/tests/unittests/sequence/test_sequence_reverse.py rename to test/sequence/test_sequence_reverse.py index dfd532ad8d4..46c28228e46 100644 --- a/python/paddle/fluid/tests/unittests/sequence/test_sequence_reverse.py +++ b/test/sequence/test_sequence_reverse.py @@ -19,7 +19,7 @@ import numpy as np import paddle -sys.path.append("../") +sys.path.append("../../python/paddle/fluid/tests/unittests") from eager_op_test import OpTest diff --git a/python/paddle/fluid/tests/unittests/sequence/test_sequence_scatter_op.py b/test/sequence/test_sequence_scatter_op.py similarity index 97% rename from python/paddle/fluid/tests/unittests/sequence/test_sequence_scatter_op.py rename to test/sequence/test_sequence_scatter_op.py index 2f04dc81edf..bc6341e6910 100644 --- a/python/paddle/fluid/tests/unittests/sequence/test_sequence_scatter_op.py +++ b/test/sequence/test_sequence_scatter_op.py @@ -17,7 +17,7 @@ import unittest import numpy as np -sys.path.append("../") +sys.path.append("../../python/paddle/fluid/tests/unittests") from eager_op_test import OpTest diff --git a/python/paddle/fluid/tests/unittests/sequence/test_sequence_slice_op.py b/test/sequence/test_sequence_slice_op.py similarity index 97% rename from python/paddle/fluid/tests/unittests/sequence/test_sequence_slice_op.py rename to test/sequence/test_sequence_slice_op.py index 8ddbe8fb969..ded382d38c5 100644 --- a/python/paddle/fluid/tests/unittests/sequence/test_sequence_slice_op.py +++ b/test/sequence/test_sequence_slice_op.py @@ -17,7 +17,7 @@ import unittest import numpy as np -sys.path.append("../") +sys.path.append("../../python/paddle/fluid/tests/unittests") from eager_op_test import OpTest diff --git a/python/paddle/fluid/tests/unittests/sequence/test_sequence_softmax_op.py b/test/sequence/test_sequence_softmax_op.py similarity index 97% rename from python/paddle/fluid/tests/unittests/sequence/test_sequence_softmax_op.py rename to test/sequence/test_sequence_softmax_op.py index 4f088269bdc..400e4932b62 100644 --- a/python/paddle/fluid/tests/unittests/sequence/test_sequence_softmax_op.py +++ b/test/sequence/test_sequence_softmax_op.py @@ -19,7 +19,7 @@ import numpy as np from paddle.fluid import core -sys.path.append("../") +sys.path.append("../../python/paddle/fluid/tests/unittests") from eager_op_test import OpTest from test_softmax_op import stable_softmax diff --git a/python/paddle/fluid/tests/unittests/sequence/test_sequence_topk_avg_pooling.py b/test/sequence/test_sequence_topk_avg_pooling.py similarity index 99% rename from python/paddle/fluid/tests/unittests/sequence/test_sequence_topk_avg_pooling.py rename to test/sequence/test_sequence_topk_avg_pooling.py index 4fcb20f1500..98dcba0dfa5 100644 --- a/python/paddle/fluid/tests/unittests/sequence/test_sequence_topk_avg_pooling.py +++ b/test/sequence/test_sequence_topk_avg_pooling.py @@ -18,7 +18,7 @@ from copy import deepcopy import numpy as np -sys.path.append("../") +sys.path.append("../../python/paddle/fluid/tests/unittests") from eager_op_test import OpTest diff --git a/python/paddle/fluid/tests/unittests/sequence/test_sequence_unpad_op.py b/test/sequence/test_sequence_unpad_op.py similarity index 98% rename from python/paddle/fluid/tests/unittests/sequence/test_sequence_unpad_op.py rename to test/sequence/test_sequence_unpad_op.py index 4f280963512..133e4fae47b 100644 --- a/python/paddle/fluid/tests/unittests/sequence/test_sequence_unpad_op.py +++ b/test/sequence/test_sequence_unpad_op.py @@ -17,7 +17,7 @@ import unittest import numpy as np -sys.path.append("../") +sys.path.append("../../python/paddle/fluid/tests/unittests") from eager_op_test import OpTest import paddle -- GitLab