diff --git a/test/deprecated/legacy_test/CMakeLists.txt b/test/deprecated/legacy_test/CMakeLists.txt index 18891bc1cb65e..12d4734020e2c 100644 --- a/test/deprecated/legacy_test/CMakeLists.txt +++ b/test/deprecated/legacy_test/CMakeLists.txt @@ -130,7 +130,6 @@ endif() if(WIN32) list(REMOVE_ITEM TEST_OPS test_complex_matmul) - list(REMOVE_ITEM TEST_OPS test_ops_nms) list(REMOVE_ITEM TEST_OPS test_trt_convert_preln_residual_bias) list(REMOVE_ITEM TEST_OPS test_masked_multihead_attention_op) list(REMOVE_ITEM TEST_OPS test_fused_ec_moe_op) @@ -401,8 +400,6 @@ endfunction() list(REMOVE_ITEM TEST_OPS test_feed_data_check_shape_type) list(REMOVE_ITEM TEST_OPS test_fetch_lod_tensor_array) list(REMOVE_ITEM TEST_OPS test_data_norm_op) -list(REMOVE_ITEM TEST_OPS test_bilinear_interp_op) -list(REMOVE_ITEM TEST_OPS test_nearest_interp_op) list(REMOVE_ITEM TEST_OPS test_imperative_mnist_sorted_gradient) list(REMOVE_ITEM TEST_OPS test_imperative_mnist) list(REMOVE_ITEM TEST_OPS test_layers_deprecated) @@ -452,8 +449,7 @@ endif() # Some ops need to check results when gc is enabled # Currently, only ops that register NoNeedBufferVarsInference need to do this test -set(TEST_OPS_WITH_GC test_affine_channel_op test_gather_nd_op test_scatter_op - test_slice_op) +set(TEST_OPS_WITH_GC test_gather_nd_op test_slice_op) foreach(TEST_OP ${TEST_OPS_WITH_GC}) list(REMOVE_ITEM TEST_OPS ${TEST_OP}) @@ -485,10 +481,6 @@ set_tests_properties(test_logcumsumexp_op PROPERTIES TIMEOUT 30) py_test_modules(test_adam_op_multi_thread MODULES test_adam_op ENVS FLAGS_inner_op_parallelism=4) -py_test_modules(test_bilinear_interp_op MODULES test_bilinear_interp_op ENVS - ${GC_ENVS}) -py_test_modules(test_nearest_interp_op MODULES test_nearest_interp_op ENVS - ${GC_ENVS}) py_test_modules(test_imperative_mnist MODULES test_imperative_mnist ENVS FLAGS_cudnn_deterministic=1) py_test_modules( @@ -511,8 +503,6 @@ if((WITH_GPU) AND (WITH_CUDNN_FRONTEND)) test_fused_dot_product_attention_op) endif() -set_tests_properties(test_conv2d_op_depthwise_conv - PROPERTIES LABELS "RUN_TYPE=EXCLUSIVE") set_tests_properties(test_conv2d_api_deprecated PROPERTIES LABELS "RUN_TYPE=EXCLUSIVE") set_tests_properties(test_conv_nn_grad PROPERTIES LABELS "RUN_TYPE=EXCLUSIVE") @@ -644,17 +634,10 @@ endif() set_tests_properties(test_cross_op PROPERTIES TIMEOUT 120) set_tests_properties(test_imperative_lod_tensor_to_selected_rows PROPERTIES TIMEOUT 200) -set_tests_properties(test_lstm_op PROPERTIES TIMEOUT 120) -set_tests_properties(test_imperative_star_gan_with_gradient_penalty - PROPERTIES TIMEOUT 120) -set_tests_properties(test_bicubic_interp_op PROPERTIES TIMEOUT 120) set_tests_properties(test_deformable_conv_op PROPERTIES TIMEOUT 200) -set_tests_properties(test_nearest_interp_op PROPERTIES TIMEOUT 120) set_tests_properties(test_inplace_softmax_with_cross_entropy PROPERTIES TIMEOUT 120) -set_tests_properties(test_cross_entropy2_op PROPERTIES TIMEOUT 120) -set_tests_properties(test_gru_unit_op PROPERTIES TIMEOUT 120) set_tests_properties(test_regularizer_api PROPERTIES TIMEOUT 150) if(NOT WIN32) if(WITH_NV_JETSON) @@ -666,75 +649,45 @@ set_tests_properties(test_bilateral_slice_op PROPERTIES TIMEOUT 120) set_tests_properties(test_fleet_util PROPERTIES TIMEOUT 120) set_tests_properties(test_imperative_transformer_sorted_gradient PROPERTIES TIMEOUT 120) -set_tests_properties(test_matmul_op PROPERTIES TIMEOUT 120) -set_tests_properties(test_nearest_interp_v2_op PROPERTIES TIMEOUT 120) -set_tests_properties(test_trilinear_interp_op PROPERTIES TIMEOUT 120) set_tests_properties(test_static_save_load PROPERTIES TIMEOUT 250) -set_tests_properties(test_paddle_save_load_binary PROPERTIES TIMEOUT 120) -if(WIN32) - set_tests_properties(test_static_save_load_large PROPERTIES TIMEOUT 900) -else() - set_tests_properties(test_static_save_load_large PROPERTIES TIMEOUT 600) -endif() if(WITH_NV_JETSON) set_tests_properties(test_conv3d_transpose_part2_op PROPERTIES TIMEOUT 1200) set_tests_properties(test_layer_norm_op PROPERTIES TIMEOUT 1500) - set_tests_properties(test_pool3d_op PROPERTIES TIMEOUT 1500) else() set_tests_properties(test_conv3d_transpose_part2_op PROPERTIES TIMEOUT 120) set_tests_properties(test_layer_norm_op PROPERTIES TIMEOUT 250) - set_tests_properties(test_pool3d_op PROPERTIES TIMEOUT 150) endif() set_tests_properties(test_imperative_selected_rows_to_lod_tensor PROPERTIES TIMEOUT 200) -set_tests_properties(test_index_select_op PROPERTIES TIMEOUT 120) -set_tests_properties(test_index_add_op PROPERTIES TIMEOUT 120) set_tests_properties(test_argsort_op PROPERTIES TIMEOUT 120) set_tests_properties(test_gather_nd_op PROPERTIES TIMEOUT 120) -set_tests_properties(test_row_conv_op PROPERTIES TIMEOUT 120) -set_tests_properties(test_deformable_conv_v1_op PROPERTIES TIMEOUT 300) set_tests_properties(test_imperative_ptb_rnn_sorted_gradient PROPERTIES TIMEOUT 120) -set_tests_properties(test_crop_tensor_op PROPERTIES TIMEOUT 120) set_tests_properties(test_imperative_ptb_rnn PROPERTIES TIMEOUT 120) -set_tests_properties(test_svd_op PROPERTIES TIMEOUT 80) -set_tests_properties(test_qr_op PROPERTIES TIMEOUT 60) -set_tests_properties(test_trilinear_interp_v2_op PROPERTIES TIMEOUT 120) set_tests_properties(test_masked_select_op PROPERTIES TIMEOUT 120) set_tests_properties(test_sigmoid_cross_entropy_with_logits_op PROPERTIES TIMEOUT 120) set_tests_properties(test_imperative_optimizer_v2 PROPERTIES TIMEOUT 150) -set_tests_properties(test_partial_sum_op PROPERTIES TIMEOUT 120) set_tests_properties(test_sgd_op PROPERTIES TIMEOUT 250) set_tests_properties(test_generator_dataloader_deprecated PROPERTIES TIMEOUT 120) -set_tests_properties(test_partial_concat_op PROPERTIES TIMEOUT 120) set_tests_properties(test_reduce_op PROPERTIES TIMEOUT 500) set_tests_properties(test_conv_nn_grad PROPERTIES TIMEOUT 220) set_tests_properties(test_program_prune_backward PROPERTIES TIMEOUT 120) set_tests_properties(test_imperative_optimizer_v2 PROPERTIES TIMEOUT 250) -set_tests_properties(test_bilinear_interp_op PROPERTIES TIMEOUT 120) set_tests_properties(test_decoupled_py_reader PROPERTIES TIMEOUT 120) set_tests_properties(test_fuse_bn_act_pass PROPERTIES TIMEOUT 120) -set_tests_properties(test_conv2d_op_depthwise_conv PROPERTIES TIMEOUT 120) set_tests_properties(test_conv2d_api_deprecated PROPERTIES TIMEOUT 120) -set_tests_properties(test_elementwise_mul_op PROPERTIES TIMEOUT 120) set_tests_properties(test_dygraph_multi_forward PROPERTIES TIMEOUT 120) set_tests_properties(test_imperative_ocr_attention_model PROPERTIES TIMEOUT 120) set_tests_properties(test_imperative_mnist PROPERTIES TIMEOUT 120) -set_tests_properties(test_gru_op PROPERTIES TIMEOUT 200) set_tests_properties(test_regularizer PROPERTIES TIMEOUT 150) -set_tests_properties(test_matmul_v2_op PROPERTIES TIMEOUT 120) set_tests_properties(test_slice_op PROPERTIES TIMEOUT 120) -set_tests_properties(test_pad3d_op PROPERTIES TIMEOUT 120) set_tests_properties(test_dataloader_keep_order PROPERTIES TIMEOUT 120) set_tests_properties(test_dataloader_unkeep_order PROPERTIES TIMEOUT 120) set_tests_properties(test_reader_reset PROPERTIES TIMEOUT 120) -set_tests_properties(test_cumprod_op PROPERTIES TIMEOUT 300) set_tests_properties(test_split_program PROPERTIES TIMEOUT 120) -set_tests_properties(test_graph_send_ue_recv_op PROPERTIES TIMEOUT 60) -set_tests_properties(test_graph_send_uv_op PROPERTIES TIMEOUT 60) set_tests_properties(test_uniform_random_op_deprecated PROPERTIES TIMEOUT 60) set_tests_properties(test_pretrained_model PROPERTIES TIMEOUT 120) @@ -756,36 +709,17 @@ set_tests_properties(test_inplace_addto_strategy_deprecated PROPERTIES TIMEOUT set(TEST_CINN_OPS test_softmax_op - test_expand_v2_op test_reduce_op test_slice_op - test_full_like_op - test_index_select_op - test_top_k_v2_op - test_elementwise_mul_op test_gather_nd_op - test_elementwise_pow_op - test_reshape_op - test_meshgrid_op test_scale_op - test_scatter_op test_layer_norm_op - test_cast_op - test_roll_op - test_atan2_op - test_top_k_op test_where_op test_arg_min_max_op - test_reverse_op - test_flip - test_triangular_solve_op test_scatter_nd_op test_instance_norm_op test_cumsum_op - test_split_op - test_erf_op - test_assign_op - test_flatten_contiguous_range_op) + test_erf_op) foreach(TEST_CINN_OP ${TEST_CINN_OPS}) if(WITH_CINN) @@ -810,16 +744,12 @@ set(STATIC_BUILD_TESTS test_batch_norm_op test_bincount_op test_decoupled_py_reader - test_eigh_op test_fetch_lod_tensor_array test_fuse_bn_act_pass test_layer_norm_op test_lookup_table_v2_op_deprecated - test_matmul_op - test_matmul_v2_op test_momentum_op test_nce - test_paddle_save_load_binary test_reduce_op test_sparse_conv_op test_sparse_norm_op @@ -863,11 +793,7 @@ set_tests_properties( ENVIRONMENT "FLAGS_cudnn_deterministic=1;FLAGS_cudnn_batchnorm_spatial_persistent=1;FLAGS_conv_workspace_size_limit=1000" ) -set_tests_properties(test_matmul_op_static_build PROPERTIES TIMEOUT 120) -set_tests_properties(test_matmul_v2_op_static_build PROPERTIES TIMEOUT 120) set_tests_properties(test_layer_norm_op_static_build PROPERTIES TIMEOUT 1500) -set_tests_properties(test_paddle_save_load_binary_static_build - PROPERTIES TIMEOUT 120) set_tests_properties(test_reduce_op_static_build PROPERTIES TIMEOUT 500) py_test_modules(test_stride MODULES test_stride ENVS FLAGS_use_stride_kernel=true) @@ -875,6 +801,5 @@ py_test_modules(test_stride MODULES test_stride ENVS set_tests_properties(test_linalg_matrix_exp PROPERTIES TIMEOUT 120) set_pir_tests_properties() -set_tests_properties(test_fractional_max_pool2d_op PROPERTIES TIMEOUT 120) - set_tests_properties(test_reduce_as_op PROPERTIES TIMEOUT 30) +set_tests_properties(test_attribute_var_deprecated PROPERTIES TIMEOUT 100) diff --git a/test/deprecated/legacy_test/test_adaptive_avg_pool2d.py b/test/deprecated/legacy_test/test_adaptive_avg_pool2d.py index 880a7cf949a62..5ed16ca8675b1 100644 --- a/test/deprecated/legacy_test/test_adaptive_avg_pool2d.py +++ b/test/deprecated/legacy_test/test_adaptive_avg_pool2d.py @@ -16,7 +16,7 @@ import unittest import numpy as np -from test_attribute_var import UnittestBase +from test_attribute_var_deprecated import UnittestBase import paddle from paddle.base import Program, core, program_guard diff --git a/test/deprecated/legacy_test/test_arg_min_max_op.py b/test/deprecated/legacy_test/test_arg_min_max_op.py index c35fa9f8f7d39..69b98997aeed5 100644 --- a/test/deprecated/legacy_test/test_arg_min_max_op.py +++ b/test/deprecated/legacy_test/test_arg_min_max_op.py @@ -17,7 +17,7 @@ import numpy as np from op_test import OpTest, convert_float_to_uint16 -from test_attribute_var import UnittestBase +from test_attribute_var_deprecated import UnittestBase import paddle from paddle.base import Program, program_guard diff --git a/test/deprecated/legacy_test/test_attribute_var_deprecated.py b/test/deprecated/legacy_test/test_attribute_var_deprecated.py new file mode 100644 index 0000000000000..5f09dff909395 --- /dev/null +++ b/test/deprecated/legacy_test/test_attribute_var_deprecated.py @@ -0,0 +1,107 @@ +# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import os +import tempfile +import unittest + +import numpy as np + +import paddle +import paddle.inference as paddle_infer +from paddle.base.framework import Program, program_guard + +paddle.enable_static() + + +class UnittestBase(unittest.TestCase): + def setUp(self): + self.temp_dir = tempfile.TemporaryDirectory() + self.init_info() + + def tearDwon(self): + self.temp_dir.cleanup() + + def init_info(self): + self.shapes = None + self.save_path = None + + def path_prefix(self): + return type(self).__name__ + + def infer_prog(self): + config = paddle_infer.Config( + self.save_path + '.pdmodel', self.save_path + '.pdiparams' + ) + config.disable_mkldnn() + predictor = paddle_infer.create_predictor(config) + input_names = predictor.get_input_names() + for i, shape in enumerate(self.shapes): + input_handle = predictor.get_input_handle(input_names[i]) + self.fake_input = np.random.randn(*shape).astype("float32") + input_handle.reshape(shape) + input_handle.copy_from_cpu(self.fake_input) + predictor.run() + output_names = predictor.get_output_names() + res = [] + for out_name in output_names: + output_handle = predictor.get_output_handle(out_name) + output_data = output_handle.copy_to_cpu() + res.append(output_data) + + if len(output_names) == 1: + res = res[0] + + return res + + +class TestDropout(UnittestBase): + def init_info(self): + self.shapes = [[10, 10]] + self.save_path = os.path.join(self.temp_dir.name, 'dropout') + + def test_static(self): + main_prog = Program() + startup_prog = Program() + with program_guard(main_prog, startup_prog): + fc = paddle.nn.Linear(10, 10) + x = paddle.randn(self.shapes[0]) + x.stop_gradient = False + feat = fc(x) + # p is a Variable + p = paddle.randn([1]) + out = paddle.nn.functional.dropout(feat, p=p) + sgd = paddle.optimizer.SGD() + sgd.minimize(paddle.mean(out)) + # test _to_string + self.assertTrue("Var[" in str(main_prog)) + + exe = paddle.static.Executor() + exe.run(startup_prog) + res = exe.run(fetch_list=[x, out]) + # export model + paddle.static.save_inference_model(self.save_path, [x], [out], exe) + + # Test for Inference Predictor + infer_out = self.infer_prog() + self.assertEqual(infer_out.shape, (10, 10)) + + self.assertEqual( + main_prog.block(0).ops[4].all_attrs()['dropout_prob'].name, + p.name, + ) + + +if __name__ == '__main__': + unittest.main() diff --git a/test/deprecated/legacy_test/test_eye_op.py b/test/deprecated/legacy_test/test_eye_op.py index 41a4e6aea2f9d..cafbfbd96beb0 100644 --- a/test/deprecated/legacy_test/test_eye_op.py +++ b/test/deprecated/legacy_test/test_eye_op.py @@ -17,7 +17,7 @@ import numpy as np from op_test import OpTest -from test_attribute_var import UnittestBase +from test_attribute_var_deprecated import UnittestBase import paddle from paddle import base diff --git a/test/deprecated/legacy_test/test_multinomial_op.py b/test/deprecated/legacy_test/test_multinomial_op.py index f6fc6e281193b..48c00ed5506e5 100644 --- a/test/deprecated/legacy_test/test_multinomial_op.py +++ b/test/deprecated/legacy_test/test_multinomial_op.py @@ -17,7 +17,7 @@ import numpy as np from op_test import OpTest, convert_float_to_uint16 -from test_attribute_var import UnittestBase +from test_attribute_var_deprecated import UnittestBase import paddle from paddle import base diff --git a/test/deprecated/legacy_test/test_squared_l2_norm_op.py b/test/deprecated/legacy_test/test_squared_l2_norm_op.py deleted file mode 100755 index df36c81097051..0000000000000 --- a/test/deprecated/legacy_test/test_squared_l2_norm_op.py +++ /dev/null @@ -1,148 +0,0 @@ -# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import unittest - -import numpy as np -from numpy import linalg as LA -from op_test import OpTest - -import paddle -import paddle.distributed as dist -from paddle import _C_ops, _legacy_C_ops -from paddle.framework import in_dynamic_mode - - -def test_squared_l2_norm(x): - if in_dynamic_mode(): - return _C_ops.squared_l2_norm(x) - else: - return _legacy_C_ops.squared_l2_norm(x) - - -class TestSquaredL2NormF16Op(unittest.TestCase): - def init_test_case(self): - X = np.random.uniform(-0.1, 0.1, (8, 5, 10)).astype('float32') - return X - - def check_main(self, x_np, dtype): - paddle.disable_static() - x = paddle.to_tensor(x_np) - - x.stop_gradient = False - y = test_squared_l2_norm(x) - x_g = paddle.grad(y, [x]) - - paddle.enable_static() - return y, x_g - - def test_main(self): - x_np = self.init_test_case() - y_np_1, x_g_np_1 = self.check_main(x_np, 'float32') - y_np_2, x_g_np_2 = self.check_main(x_np, 'float16') - - def assert_equal(x, y): - np.testing.assert_allclose(x, y, rtol=1e-05, atol=0.0) - - assert_equal(y_np_1, y_np_2) - assert_equal(x_g_np_1, x_g_np_2) - - -class TestSquaredL2NormF16Op1(TestSquaredL2NormF16Op): - def init_test_case(self): - X = np.random.uniform(-2.0, 2.0, (30, 10)).astype('float32') - return X - - -class TestSquaredL2NormF16Op2(TestSquaredL2NormF16Op): - def init_test_case(self): - X = np.random.uniform(-5.0, 5.0, (20, 10, 20)).astype('float32') - return X - - -class TestL2LossOp(OpTest): - """Test squared_l2_norm""" - - def config(self): - self.x_shape = (13, 19) - self.check_auto_parallel = False - - def setUp(self): - self.config() - self.python_api = test_squared_l2_norm - self.op_type = "squared_l2_norm" - self.max_relative_error = 0.05 - - X = np.random.uniform(-1, 1, self.x_shape).astype("float32") - X[np.abs(X) < self.max_relative_error] = 0.1 - self.inputs = {'X': X} - self.outputs = {'Out': np.array([np.square(LA.norm(X))])} - - def test_check_output(self): - self.check_output() - - def test_check_grad(self): - self.check_grad( - ['X'], - 'Out', - max_relative_error=self.max_relative_error, - check_auto_parallel=self.check_auto_parallel, - ) - - -class TestSquaredL2NormAutoParallel_1(TestL2LossOp): - def config(self): - self.x_shape = (14, 18) - self.check_auto_parallel = True - self.placements = { - 'X': [dist.Replicate()], - } - - -class TestSquaredL2NormAutoParallel_2(TestL2LossOp): - def config(self): - self.x_shape = (14, 18) - self.check_auto_parallel = True - self.placements = { - 'X': [dist.Shard(0)], - } - - -class TestSquaredL2NormAutoParallel_3(TestL2LossOp): - def config(self): - self.x_shape = (14, 18) - self.check_auto_parallel = True - self.placements = { - 'X': [dist.Shard(1)], - } - - -class TestL2LossDeterministic(unittest.TestCase): - def check_place(self, place): - with paddle.base.dygraph.guard(place): - x_np = np.random.rand(5, 11, 13).astype('float32') - x = paddle.to_tensor(x_np) - y1 = _legacy_C_ops.squared_l2_norm(x) - y2 = _legacy_C_ops.squared_l2_norm(x) - np.testing.assert_array_equal(y1.numpy(), y2.numpy()) - - def test_main(self): - self.check_place(paddle.CPUPlace()) - if paddle.is_compiled_with_cuda(): - self.check_place(paddle.CUDAPlace(0)) - - -if __name__ == "__main__": - paddle.enable_static() - unittest.main() diff --git a/test/deprecated/legacy_test/test_squeeze2_op_rename.py b/test/deprecated/legacy_test/test_squeeze2_op_rename.py index ed347eda7350b..02e63c0cb2459 100644 --- a/test/deprecated/legacy_test/test_squeeze2_op_rename.py +++ b/test/deprecated/legacy_test/test_squeeze2_op_rename.py @@ -15,7 +15,7 @@ import os import unittest -from test_attribute_var import UnittestBase +from test_attribute_var_deprecated import UnittestBase import paddle from paddle.base.framework import Program, program_guard diff --git a/test/legacy_test/CMakeLists.txt b/test/legacy_test/CMakeLists.txt index 520766f2b7a4c..f84458dd494f3 100644 --- a/test/legacy_test/CMakeLists.txt +++ b/test/legacy_test/CMakeLists.txt @@ -155,6 +155,7 @@ if(WIN32) list(REMOVE_ITEM TEST_OPS test_fused_layernorm_op) list(REMOVE_ITEM TEST_OPS test_matmul_int8_op) list(REMOVE_ITEM TEST_OPS test_variable_length_memory_efficient_attention) + list(REMOVE_ITEM TEST_OPS test_ops_nms) endif() list(REMOVE_ITEM TEST_OPS test_checkpoint_saver) @@ -433,6 +434,8 @@ list(REMOVE_ITEM TEST_OPS test_basic_lstm_unit_op) list(REMOVE_ITEM TEST_OPS test_fuse_bn_add_act_pass) list(REMOVE_ITEM TEST_OPS test_conv3d_transpose_op) list(REMOVE_ITEM TEST_OPS test_layers) +list(REMOVE_ITEM TEST_OPS test_bilinear_interp_op) +list(REMOVE_ITEM TEST_OPS test_nearest_interp_op) # disable this unittest temporarily list(REMOVE_ITEM TEST_OPS test_imperative_data_loader_exception) @@ -481,6 +484,8 @@ endif() # Some ops need to check results when gc is enabled # Currently, only ops that register NoNeedBufferVarsInference need to do this test set(TEST_OPS_WITH_GC + test_affine_channel_op + test_scatter_op test_concat_op test_elementwise_add_op test_lookup_table_op @@ -567,6 +572,11 @@ if((WITH_GPU) AND (WITH_CUDNN_FRONTEND)) test_fused_dot_product_attention_op) endif() +py_test_modules(test_bilinear_interp_op MODULES test_bilinear_interp_op ENVS + ${GC_ENVS}) +py_test_modules(test_nearest_interp_op MODULES test_nearest_interp_op ENVS + ${GC_ENVS}) + set_tests_properties(test_conv2d_op PROPERTIES LABELS "RUN_TYPE=EXCLUSIVE") set_tests_properties(test_norm_nn_grad PROPERTIES LABELS "RUN_TYPE=EXCLUSIVE") set_tests_properties(test_nn_grad PROPERTIES LABELS "RUN_TYPE=EXCLUSIVE") @@ -785,12 +795,14 @@ if(WITH_NV_JETSON) set_tests_properties(test_norm_op PROPERTIES TIMEOUT 1200) set_tests_properties(test_batch_norm_op_prim_nchw PROPERTIES TIMEOUT 1500) set_tests_properties(test_batch_norm_op_prim_nhwc PROPERTIES TIMEOUT 1500) + set_tests_properties(test_pool3d_op PROPERTIES TIMEOUT 1500) else() set_tests_properties(test_concat_op PROPERTIES TIMEOUT 400) set_tests_properties(test_conv3d_op PROPERTIES TIMEOUT 120) set_tests_properties(test_norm_op PROPERTIES TIMEOUT 150) set_tests_properties(test_batch_norm_op_prim_nchw PROPERTIES TIMEOUT 250) set_tests_properties(test_batch_norm_op_prim_nhwc PROPERTIES TIMEOUT 250) + set_tests_properties(test_pool3d_op PROPERTIES TIMEOUT 150) endif() if((WITH_GPU OR WITH_ROCM) AND (LINUX)) py_test_modules(test_conv3d_transpose_op MODULES test_conv3d_transpose_op @@ -943,6 +955,9 @@ if(WITH_CUDNN_FRONTEND) endif() set(TEST_CINN_OPS + test_assign_op + test_atan2_op + test_cast_op test_stack_op test_activation_op test_fill_any_like_op @@ -951,6 +966,22 @@ set(TEST_CINN_OPS test_elementwise_sub_op test_elementwise_div_op test_elementwise_max_op + test_elementwise_mul_op + test_elementwise_pow_op + test_expand_v2_op + test_flatten_contiguous_range_op + test_flip + test_full_like_op + test_top_k_op + test_top_k_v2_op + test_reshape_op + test_triangular_solve_op + test_split_op + test_scatter_op + test_reverse_op + test_roll_op + test_meshgrid_op + test_index_select_op test_mean_op test_clip_op test_gather_op @@ -994,6 +1025,10 @@ set_tests_properties( # These UTs are to temporarily test static build for standalone_executor, will be removed after static build is enabled by default. set(STATIC_BUILD_TESTS test_adagrad_op + test_eigh_op + test_matmul_op + test_matmul_v2_op + test_paddle_save_load_binary test_assign_pos_op test_bucketize_api test_c_embedding_op @@ -1096,3 +1131,45 @@ set_pir_tests_properties() set_tests_properties(test_nadam_op PROPERTIES TIMEOUT 100) set_tests_properties(test_radam_op PROPERTIES TIMEOUT 100) set_tests_properties(test_nan_inf PROPERTIES TIMEOUT 120) +set_tests_properties(test_bicubic_interp_op PROPERTIES TIMEOUT 120) +set_tests_properties(test_bilinear_interp_op PROPERTIES TIMEOUT 120) +set_tests_properties(test_conv2d_op_depthwise_conv + PROPERTIES LABELS "RUN_TYPE=EXCLUSIVE") +set_tests_properties(test_conv2d_op_depthwise_conv PROPERTIES TIMEOUT 120) +set_tests_properties(test_crop_tensor_op PROPERTIES TIMEOUT 120) +set_tests_properties(test_cross_entropy2_op PROPERTIES TIMEOUT 120) +set_tests_properties(test_cumprod_op PROPERTIES TIMEOUT 300) +set_tests_properties(test_deformable_conv_v1_op PROPERTIES TIMEOUT 300) +set_tests_properties(test_elementwise_mul_op PROPERTIES TIMEOUT 120) +set_tests_properties(test_fractional_max_pool2d_op PROPERTIES TIMEOUT 120) +set_tests_properties(test_graph_send_ue_recv_op PROPERTIES TIMEOUT 60) +set_tests_properties(test_graph_send_uv_op PROPERTIES TIMEOUT 60) +set_tests_properties(test_gru_op PROPERTIES TIMEOUT 200) +set_tests_properties(test_gru_unit_op PROPERTIES TIMEOUT 120) +set_tests_properties(test_imperative_star_gan_with_gradient_penalty + PROPERTIES TIMEOUT 120) +set_tests_properties(test_index_add_op PROPERTIES TIMEOUT 120) +set_tests_properties(test_index_select_op PROPERTIES TIMEOUT 120) +set_tests_properties(test_lstm_op PROPERTIES TIMEOUT 120) +set_tests_properties(test_matmul_op PROPERTIES TIMEOUT 120) +set_tests_properties(test_matmul_v2_op PROPERTIES TIMEOUT 120) +set_tests_properties(test_nearest_interp_op PROPERTIES TIMEOUT 120) +set_tests_properties(test_nearest_interp_v2_op PROPERTIES TIMEOUT 120) +set_tests_properties(test_pad3d_op PROPERTIES TIMEOUT 120) +set_tests_properties(test_paddle_save_load_binary PROPERTIES TIMEOUT 120) +set_tests_properties(test_partial_concat_op PROPERTIES TIMEOUT 120) +set_tests_properties(test_partial_sum_op PROPERTIES TIMEOUT 120) +set_tests_properties(test_qr_op PROPERTIES TIMEOUT 60) +set_tests_properties(test_row_conv_op PROPERTIES TIMEOUT 120) +if(WIN32) + set_tests_properties(test_static_save_load_large PROPERTIES TIMEOUT 900) +else() + set_tests_properties(test_static_save_load_large PROPERTIES TIMEOUT 600) +endif() +set_tests_properties(test_svd_op PROPERTIES TIMEOUT 80) +set_tests_properties(test_trilinear_interp_op PROPERTIES TIMEOUT 120) +set_tests_properties(test_trilinear_interp_v2_op PROPERTIES TIMEOUT 120) +set_tests_properties(test_matmul_op_static_build PROPERTIES TIMEOUT 120) +set_tests_properties(test_matmul_v2_op_static_build PROPERTIES TIMEOUT 120) +set_tests_properties(test_paddle_save_load_binary_static_build + PROPERTIES TIMEOUT 120) diff --git a/test/deprecated/legacy_test/test_accuracy_op.py b/test/legacy_test/test_accuracy_op.py similarity index 99% rename from test/deprecated/legacy_test/test_accuracy_op.py rename to test/legacy_test/test_accuracy_op.py index 44c4cfa7c49ac..bf6d86d10da9e 100755 --- a/test/deprecated/legacy_test/test_accuracy_op.py +++ b/test/legacy_test/test_accuracy_op.py @@ -126,7 +126,7 @@ def test_type_errors(self): self.assertRaises(TypeError, paddle.metric.accuracy, x2, label) x3 = paddle.static.data( - name='input', shape=[-1, 2], dtype="float16" + name='input', shape=[-1, 2], dtype="float32" ) paddle.static.accuracy(input=x3, label=label) paddle.metric.accuracy(input=x3, label=label) diff --git a/test/deprecated/legacy_test/test_add_position_encoding_op.py b/test/legacy_test/test_add_position_encoding_op.py similarity index 100% rename from test/deprecated/legacy_test/test_add_position_encoding_op.py rename to test/legacy_test/test_add_position_encoding_op.py diff --git a/test/deprecated/legacy_test/test_addmm_op.py b/test/legacy_test/test_addmm_op.py similarity index 100% rename from test/deprecated/legacy_test/test_addmm_op.py rename to test/legacy_test/test_addmm_op.py diff --git a/test/deprecated/legacy_test/test_affine_channel_op.py b/test/legacy_test/test_affine_channel_op.py similarity index 100% rename from test/deprecated/legacy_test/test_affine_channel_op.py rename to test/legacy_test/test_affine_channel_op.py diff --git a/test/deprecated/legacy_test/test_affine_grid_op.py b/test/legacy_test/test_affine_grid_op.py similarity index 100% rename from test/deprecated/legacy_test/test_affine_grid_op.py rename to test/legacy_test/test_affine_grid_op.py diff --git a/test/deprecated/legacy_test/test_assign_op.py b/test/legacy_test/test_assign_op.py similarity index 100% rename from test/deprecated/legacy_test/test_assign_op.py rename to test/legacy_test/test_assign_op.py diff --git a/test/deprecated/legacy_test/test_atan2_op.py b/test/legacy_test/test_atan2_op.py similarity index 100% rename from test/deprecated/legacy_test/test_atan2_op.py rename to test/legacy_test/test_atan2_op.py diff --git a/test/deprecated/legacy_test/test_attribute_var.py b/test/legacy_test/test_attribute_var.py similarity index 82% rename from test/deprecated/legacy_test/test_attribute_var.py rename to test/legacy_test/test_attribute_var.py index e06e8a3d80d50..cdae49ba0741a 100644 --- a/test/deprecated/legacy_test/test_attribute_var.py +++ b/test/legacy_test/test_attribute_var.py @@ -66,43 +66,6 @@ def infer_prog(self): return res -class TestDropout(UnittestBase): - def init_info(self): - self.shapes = [[10, 10]] - self.save_path = os.path.join(self.temp_dir.name, 'dropout') - - def test_static(self): - main_prog = Program() - startup_prog = Program() - with program_guard(main_prog, startup_prog): - fc = paddle.nn.Linear(10, 10) - x = paddle.randn(self.shapes[0]) - x.stop_gradient = False - feat = fc(x) - # p is a Variable - p = paddle.randn([1]) - out = paddle.nn.functional.dropout(feat, p=p) - sgd = paddle.optimizer.SGD() - sgd.minimize(paddle.mean(out)) - # test _to_string - self.assertTrue("Var[" in str(main_prog)) - - exe = paddle.static.Executor() - exe.run(startup_prog) - res = exe.run(fetch_list=[x, out]) - # export model - paddle.static.save_inference_model(self.save_path, [x], [out], exe) - - # Test for Inference Predictor - infer_out = self.infer_prog() - self.assertEqual(infer_out.shape, (10, 10)) - - self.assertEqual( - main_prog.block(0).ops[4].all_attrs()['dropout_prob'].name, - p.name, - ) - - class TestTileTensorList(UnittestBase): def init_info(self): self.shapes = [[2, 3, 4]] diff --git a/test/deprecated/legacy_test/test_bce_loss.py b/test/legacy_test/test_bce_loss.py similarity index 100% rename from test/deprecated/legacy_test/test_bce_loss.py rename to test/legacy_test/test_bce_loss.py diff --git a/test/deprecated/legacy_test/test_bicubic_interp_op.py b/test/legacy_test/test_bicubic_interp_op.py similarity index 100% rename from test/deprecated/legacy_test/test_bicubic_interp_op.py rename to test/legacy_test/test_bicubic_interp_op.py diff --git a/test/deprecated/legacy_test/test_bilinear_interp_op.py b/test/legacy_test/test_bilinear_interp_op.py similarity index 100% rename from test/deprecated/legacy_test/test_bilinear_interp_op.py rename to test/legacy_test/test_bilinear_interp_op.py diff --git a/test/deprecated/legacy_test/test_bmm_op.py b/test/legacy_test/test_bmm_op.py similarity index 100% rename from test/deprecated/legacy_test/test_bmm_op.py rename to test/legacy_test/test_bmm_op.py diff --git a/test/deprecated/legacy_test/test_cast_op.py b/test/legacy_test/test_cast_op.py similarity index 100% rename from test/deprecated/legacy_test/test_cast_op.py rename to test/legacy_test/test_cast_op.py diff --git a/test/deprecated/legacy_test/test_channel_shuffle.py b/test/legacy_test/test_channel_shuffle.py similarity index 100% rename from test/deprecated/legacy_test/test_channel_shuffle.py rename to test/legacy_test/test_channel_shuffle.py diff --git a/test/deprecated/legacy_test/test_complex_abs.py b/test/legacy_test/test_complex_abs.py similarity index 100% rename from test/deprecated/legacy_test/test_complex_abs.py rename to test/legacy_test/test_complex_abs.py diff --git a/test/deprecated/legacy_test/test_complex_op.py b/test/legacy_test/test_complex_op.py similarity index 100% rename from test/deprecated/legacy_test/test_complex_op.py rename to test/legacy_test/test_complex_op.py diff --git a/test/deprecated/legacy_test/test_complex_variable.py b/test/legacy_test/test_complex_variable.py similarity index 100% rename from test/deprecated/legacy_test/test_complex_variable.py rename to test/legacy_test/test_complex_variable.py diff --git a/test/deprecated/legacy_test/test_complex_view_op.py b/test/legacy_test/test_complex_view_op.py similarity index 100% rename from test/deprecated/legacy_test/test_complex_view_op.py rename to test/legacy_test/test_complex_view_op.py diff --git a/test/deprecated/legacy_test/test_conj_op.py b/test/legacy_test/test_conj_op.py similarity index 100% rename from test/deprecated/legacy_test/test_conj_op.py rename to test/legacy_test/test_conj_op.py diff --git a/test/deprecated/legacy_test/test_conv2d_op_depthwise_conv.py b/test/legacy_test/test_conv2d_op_depthwise_conv.py similarity index 100% rename from test/deprecated/legacy_test/test_conv2d_op_depthwise_conv.py rename to test/legacy_test/test_conv2d_op_depthwise_conv.py diff --git a/test/deprecated/legacy_test/test_conv2d_transpose_op_depthwise_conv.py b/test/legacy_test/test_conv2d_transpose_op_depthwise_conv.py similarity index 100% rename from test/deprecated/legacy_test/test_conv2d_transpose_op_depthwise_conv.py rename to test/legacy_test/test_conv2d_transpose_op_depthwise_conv.py diff --git a/test/deprecated/legacy_test/test_copysign_op.py b/test/legacy_test/test_copysign_op.py similarity index 100% rename from test/deprecated/legacy_test/test_copysign_op.py rename to test/legacy_test/test_copysign_op.py diff --git a/test/deprecated/legacy_test/test_crop_tensor_op.py b/test/legacy_test/test_crop_tensor_op.py similarity index 100% rename from test/deprecated/legacy_test/test_crop_tensor_op.py rename to test/legacy_test/test_crop_tensor_op.py diff --git a/test/deprecated/legacy_test/test_cross_entropy2_op.py b/test/legacy_test/test_cross_entropy2_op.py similarity index 100% rename from test/deprecated/legacy_test/test_cross_entropy2_op.py rename to test/legacy_test/test_cross_entropy2_op.py diff --git a/test/deprecated/legacy_test/test_cross_entropy_op.py b/test/legacy_test/test_cross_entropy_op.py similarity index 100% rename from test/deprecated/legacy_test/test_cross_entropy_op.py rename to test/legacy_test/test_cross_entropy_op.py diff --git a/test/deprecated/legacy_test/test_cummax_op.py b/test/legacy_test/test_cummax_op.py similarity index 100% rename from test/deprecated/legacy_test/test_cummax_op.py rename to test/legacy_test/test_cummax_op.py diff --git a/test/deprecated/legacy_test/test_cumprod_op.py b/test/legacy_test/test_cumprod_op.py similarity index 100% rename from test/deprecated/legacy_test/test_cumprod_op.py rename to test/legacy_test/test_cumprod_op.py diff --git a/test/deprecated/legacy_test/test_deformable_conv_v1_op.py b/test/legacy_test/test_deformable_conv_v1_op.py similarity index 100% rename from test/deprecated/legacy_test/test_deformable_conv_v1_op.py rename to test/legacy_test/test_deformable_conv_v1_op.py diff --git a/test/deprecated/legacy_test/test_determinant_op.py b/test/legacy_test/test_determinant_op.py similarity index 100% rename from test/deprecated/legacy_test/test_determinant_op.py rename to test/legacy_test/test_determinant_op.py diff --git a/test/deprecated/legacy_test/test_diagonal_op.py b/test/legacy_test/test_diagonal_op.py similarity index 100% rename from test/deprecated/legacy_test/test_diagonal_op.py rename to test/legacy_test/test_diagonal_op.py diff --git a/test/deprecated/legacy_test/test_eigh_op.py b/test/legacy_test/test_eigh_op.py similarity index 100% rename from test/deprecated/legacy_test/test_eigh_op.py rename to test/legacy_test/test_eigh_op.py diff --git a/test/deprecated/legacy_test/test_elementwise_heaviside_op.py b/test/legacy_test/test_elementwise_heaviside_op.py similarity index 100% rename from test/deprecated/legacy_test/test_elementwise_heaviside_op.py rename to test/legacy_test/test_elementwise_heaviside_op.py diff --git a/test/deprecated/legacy_test/test_elementwise_mul_op.py b/test/legacy_test/test_elementwise_mul_op.py similarity index 100% rename from test/deprecated/legacy_test/test_elementwise_mul_op.py rename to test/legacy_test/test_elementwise_mul_op.py diff --git a/test/deprecated/legacy_test/test_elementwise_pow_op.py b/test/legacy_test/test_elementwise_pow_op.py similarity index 100% rename from test/deprecated/legacy_test/test_elementwise_pow_op.py rename to test/legacy_test/test_elementwise_pow_op.py diff --git a/test/deprecated/legacy_test/test_expand_v2_op.py b/test/legacy_test/test_expand_v2_op.py similarity index 100% rename from test/deprecated/legacy_test/test_expand_v2_op.py rename to test/legacy_test/test_expand_v2_op.py diff --git a/test/deprecated/legacy_test/test_fill_any_op.py b/test/legacy_test/test_fill_any_op.py similarity index 100% rename from test/deprecated/legacy_test/test_fill_any_op.py rename to test/legacy_test/test_fill_any_op.py diff --git a/test/deprecated/legacy_test/test_fill_diagonal_tensor_op.py b/test/legacy_test/test_fill_diagonal_tensor_op.py similarity index 100% rename from test/deprecated/legacy_test/test_fill_diagonal_tensor_op.py rename to test/legacy_test/test_fill_diagonal_tensor_op.py diff --git a/test/deprecated/legacy_test/test_flatten_contiguous_range_op.py b/test/legacy_test/test_flatten_contiguous_range_op.py similarity index 100% rename from test/deprecated/legacy_test/test_flatten_contiguous_range_op.py rename to test/legacy_test/test_flatten_contiguous_range_op.py diff --git a/test/deprecated/legacy_test/test_flip.py b/test/legacy_test/test_flip.py similarity index 100% rename from test/deprecated/legacy_test/test_flip.py rename to test/legacy_test/test_flip.py diff --git a/test/deprecated/legacy_test/test_fmax_op.py b/test/legacy_test/test_fmax_op.py similarity index 100% rename from test/deprecated/legacy_test/test_fmax_op.py rename to test/legacy_test/test_fmax_op.py diff --git a/test/deprecated/legacy_test/test_fmin_op.py b/test/legacy_test/test_fmin_op.py similarity index 100% rename from test/deprecated/legacy_test/test_fmin_op.py rename to test/legacy_test/test_fmin_op.py diff --git a/test/deprecated/legacy_test/test_fold_op.py b/test/legacy_test/test_fold_op.py similarity index 100% rename from test/deprecated/legacy_test/test_fold_op.py rename to test/legacy_test/test_fold_op.py diff --git a/test/deprecated/legacy_test/test_fractional_max_pool2d_op.py b/test/legacy_test/test_fractional_max_pool2d_op.py similarity index 100% rename from test/deprecated/legacy_test/test_fractional_max_pool2d_op.py rename to test/legacy_test/test_fractional_max_pool2d_op.py diff --git a/test/deprecated/legacy_test/test_full_like_op.py b/test/legacy_test/test_full_like_op.py similarity index 100% rename from test/deprecated/legacy_test/test_full_like_op.py rename to test/legacy_test/test_full_like_op.py diff --git a/test/deprecated/legacy_test/test_gammaln_op.py b/test/legacy_test/test_gammaln_op.py similarity index 100% rename from test/deprecated/legacy_test/test_gammaln_op.py rename to test/legacy_test/test_gammaln_op.py diff --git a/test/deprecated/legacy_test/test_gaussian_random_op.py b/test/legacy_test/test_gaussian_random_op.py similarity index 100% rename from test/deprecated/legacy_test/test_gaussian_random_op.py rename to test/legacy_test/test_gaussian_random_op.py diff --git a/test/deprecated/legacy_test/test_graph_send_recv_op.py b/test/legacy_test/test_graph_send_recv_op.py similarity index 100% rename from test/deprecated/legacy_test/test_graph_send_recv_op.py rename to test/legacy_test/test_graph_send_recv_op.py diff --git a/test/deprecated/legacy_test/test_graph_send_ue_recv_op.py b/test/legacy_test/test_graph_send_ue_recv_op.py similarity index 100% rename from test/deprecated/legacy_test/test_graph_send_ue_recv_op.py rename to test/legacy_test/test_graph_send_ue_recv_op.py diff --git a/test/deprecated/legacy_test/test_graph_send_uv_op.py b/test/legacy_test/test_graph_send_uv_op.py similarity index 100% rename from test/deprecated/legacy_test/test_graph_send_uv_op.py rename to test/legacy_test/test_graph_send_uv_op.py diff --git a/test/deprecated/legacy_test/test_grid_sampler_op.py b/test/legacy_test/test_grid_sampler_op.py similarity index 100% rename from test/deprecated/legacy_test/test_grid_sampler_op.py rename to test/legacy_test/test_grid_sampler_op.py diff --git a/test/deprecated/legacy_test/test_gru_op.py b/test/legacy_test/test_gru_op.py similarity index 100% rename from test/deprecated/legacy_test/test_gru_op.py rename to test/legacy_test/test_gru_op.py diff --git a/test/deprecated/legacy_test/test_gru_unit_op.py b/test/legacy_test/test_gru_unit_op.py similarity index 100% rename from test/deprecated/legacy_test/test_gru_unit_op.py rename to test/legacy_test/test_gru_unit_op.py diff --git a/test/deprecated/legacy_test/test_gumbel_softmax_op.py b/test/legacy_test/test_gumbel_softmax_op.py similarity index 100% rename from test/deprecated/legacy_test/test_gumbel_softmax_op.py rename to test/legacy_test/test_gumbel_softmax_op.py diff --git a/test/deprecated/legacy_test/test_hinge_loss_op.py b/test/legacy_test/test_hinge_loss_op.py similarity index 100% rename from test/deprecated/legacy_test/test_hinge_loss_op.py rename to test/legacy_test/test_hinge_loss_op.py diff --git a/test/deprecated/legacy_test/test_huber_loss_op.py b/test/legacy_test/test_huber_loss_op.py similarity index 100% rename from test/deprecated/legacy_test/test_huber_loss_op.py rename to test/legacy_test/test_huber_loss_op.py diff --git a/test/deprecated/legacy_test/test_identity_loss_op.py b/test/legacy_test/test_identity_loss_op.py similarity index 100% rename from test/deprecated/legacy_test/test_identity_loss_op.py rename to test/legacy_test/test_identity_loss_op.py diff --git a/test/deprecated/legacy_test/test_im2sequence_op.py b/test/legacy_test/test_im2sequence_op.py similarity index 100% rename from test/deprecated/legacy_test/test_im2sequence_op.py rename to test/legacy_test/test_im2sequence_op.py diff --git a/test/deprecated/legacy_test/test_imperative_framework.py b/test/legacy_test/test_imperative_framework.py similarity index 77% rename from test/deprecated/legacy_test/test_imperative_framework.py rename to test/legacy_test/test_imperative_framework.py index 01f6d37eed4b1..b85eeb11df517 100644 --- a/test/deprecated/legacy_test/test_imperative_framework.py +++ b/test/legacy_test/test_imperative_framework.py @@ -15,7 +15,6 @@ import unittest import numpy as np -from test_imperative_base import new_program_scope import paddle from paddle import base @@ -53,21 +52,13 @@ def forward(self, inputs): class TestDygraphFramework(unittest.TestCase): - def test_dygraph_backward(self): - with new_program_scope(): - mlp = MLP(input_size=2) - var_inp = paddle.static.data("input", shape=[2, 2], dtype="float32") - out = mlp(var_inp) - try: - out.backward() - raise AssertionError( - "backward should not be usable in static graph mode" - ) - except AssertionError as e: - self.assertTrue(e is not None) - def test_dygraph_to_string(self): np_inp = np.array([[1.0, 2.0], [3.0, 4.0]], dtype=np.float32) with base.dygraph.guard(): var_inp = paddle.to_tensor(np_inp) print(str(var_inp)) + + +if __name__ == '__main__': + paddle.disable_static() + unittest.main() diff --git a/test/deprecated/legacy_test/test_imperative_star_gan_with_gradient_penalty.py b/test/legacy_test/test_imperative_star_gan_with_gradient_penalty.py similarity index 100% rename from test/deprecated/legacy_test/test_imperative_star_gan_with_gradient_penalty.py rename to test/legacy_test/test_imperative_star_gan_with_gradient_penalty.py diff --git a/test/deprecated/legacy_test/test_index_add_op.py b/test/legacy_test/test_index_add_op.py similarity index 100% rename from test/deprecated/legacy_test/test_index_add_op.py rename to test/legacy_test/test_index_add_op.py diff --git a/test/deprecated/legacy_test/test_index_sample_op.py b/test/legacy_test/test_index_sample_op.py similarity index 100% rename from test/deprecated/legacy_test/test_index_sample_op.py rename to test/legacy_test/test_index_sample_op.py diff --git a/test/deprecated/legacy_test/test_index_select_op.py b/test/legacy_test/test_index_select_op.py similarity index 100% rename from test/deprecated/legacy_test/test_index_select_op.py rename to test/legacy_test/test_index_select_op.py diff --git a/test/deprecated/legacy_test/test_input_spec.py b/test/legacy_test/test_input_spec.py similarity index 96% rename from test/deprecated/legacy_test/test_input_spec.py rename to test/legacy_test/test_input_spec.py index 8f86d002da306..aa649b58ca2a8 100644 --- a/test/deprecated/legacy_test/test_input_spec.py +++ b/test/legacy_test/test_input_spec.py @@ -35,9 +35,17 @@ def test_default(self): self.assertIsNone(tensor_spec.name) def test_from_tensor(self): - x_bool = paddle.tensor.fill_constant( - shape=[1], dtype='bool', value=True - ) + if paddle.framework.use_pir_api(): + x_bool = paddle.pir.core.create_parameter( + dtype='float32', + shape=[1], + name='xx', + initializer=paddle.nn.initializer.Uniform(), + ) + else: + x_bool = paddle.tensor.fill_constant( + shape=[1], dtype='bool', value=True + ) bool_spec = InputSpec.from_tensor(x_bool) self.assertEqual(bool_spec.dtype, x_bool.dtype) self.assertEqual(list(bool_spec.shape), list(x_bool.shape)) diff --git a/test/deprecated/legacy_test/test_instance_norm_op_v2.py b/test/legacy_test/test_instance_norm_op_v2.py similarity index 100% rename from test/deprecated/legacy_test/test_instance_norm_op_v2.py rename to test/legacy_test/test_instance_norm_op_v2.py diff --git a/test/deprecated/legacy_test/test_is_integer.py b/test/legacy_test/test_is_integer.py similarity index 100% rename from test/deprecated/legacy_test/test_is_integer.py rename to test/legacy_test/test_is_integer.py diff --git a/test/deprecated/legacy_test/test_kldiv_loss_op.py b/test/legacy_test/test_kldiv_loss_op.py similarity index 100% rename from test/deprecated/legacy_test/test_kldiv_loss_op.py rename to test/legacy_test/test_kldiv_loss_op.py diff --git a/test/deprecated/legacy_test/test_kron_op.py b/test/legacy_test/test_kron_op.py similarity index 100% rename from test/deprecated/legacy_test/test_kron_op.py rename to test/legacy_test/test_kron_op.py diff --git a/test/deprecated/legacy_test/test_kthvalue_op.py b/test/legacy_test/test_kthvalue_op.py similarity index 100% rename from test/deprecated/legacy_test/test_kthvalue_op.py rename to test/legacy_test/test_kthvalue_op.py diff --git a/test/deprecated/legacy_test/test_l1_norm_op.py b/test/legacy_test/test_l1_norm_op.py similarity index 100% rename from test/deprecated/legacy_test/test_l1_norm_op.py rename to test/legacy_test/test_l1_norm_op.py diff --git a/test/deprecated/legacy_test/test_label_smooth_op.py b/test/legacy_test/test_label_smooth_op.py similarity index 100% rename from test/deprecated/legacy_test/test_label_smooth_op.py rename to test/legacy_test/test_label_smooth_op.py diff --git a/test/deprecated/legacy_test/test_lerp_op.py b/test/legacy_test/test_lerp_op.py similarity index 100% rename from test/deprecated/legacy_test/test_lerp_op.py rename to test/legacy_test/test_lerp_op.py diff --git a/test/deprecated/legacy_test/test_lgamma_op.py b/test/legacy_test/test_lgamma_op.py similarity index 100% rename from test/deprecated/legacy_test/test_lgamma_op.py rename to test/legacy_test/test_lgamma_op.py diff --git a/test/deprecated/legacy_test/test_linear_interp_op.py b/test/legacy_test/test_linear_interp_op.py similarity index 100% rename from test/deprecated/legacy_test/test_linear_interp_op.py rename to test/legacy_test/test_linear_interp_op.py diff --git a/test/deprecated/legacy_test/test_linear_interp_v2_op.py b/test/legacy_test/test_linear_interp_v2_op.py similarity index 100% rename from test/deprecated/legacy_test/test_linear_interp_v2_op.py rename to test/legacy_test/test_linear_interp_v2_op.py diff --git a/test/deprecated/legacy_test/test_load_state_dict_from_old_format.py b/test/legacy_test/test_load_state_dict_from_old_format.py similarity index 100% rename from test/deprecated/legacy_test/test_load_state_dict_from_old_format.py rename to test/legacy_test/test_load_state_dict_from_old_format.py diff --git a/test/deprecated/legacy_test/test_log_loss_op.py b/test/legacy_test/test_log_loss_op.py similarity index 100% rename from test/deprecated/legacy_test/test_log_loss_op.py rename to test/legacy_test/test_log_loss_op.py diff --git a/test/deprecated/legacy_test/test_log_softmax.py b/test/legacy_test/test_log_softmax.py similarity index 100% rename from test/deprecated/legacy_test/test_log_softmax.py rename to test/legacy_test/test_log_softmax.py diff --git a/test/deprecated/legacy_test/test_logsumexp.py b/test/legacy_test/test_logsumexp.py similarity index 100% rename from test/deprecated/legacy_test/test_logsumexp.py rename to test/legacy_test/test_logsumexp.py diff --git a/test/deprecated/legacy_test/test_lr_scheduler.py b/test/legacy_test/test_lr_scheduler.py similarity index 100% rename from test/deprecated/legacy_test/test_lr_scheduler.py rename to test/legacy_test/test_lr_scheduler.py diff --git a/test/deprecated/legacy_test/test_lrn_op.py b/test/legacy_test/test_lrn_op.py similarity index 100% rename from test/deprecated/legacy_test/test_lrn_op.py rename to test/legacy_test/test_lrn_op.py diff --git a/test/deprecated/legacy_test/test_lstm_op.py b/test/legacy_test/test_lstm_op.py similarity index 100% rename from test/deprecated/legacy_test/test_lstm_op.py rename to test/legacy_test/test_lstm_op.py diff --git a/test/deprecated/legacy_test/test_lu_unpack_op.py b/test/legacy_test/test_lu_unpack_op.py similarity index 100% rename from test/deprecated/legacy_test/test_lu_unpack_op.py rename to test/legacy_test/test_lu_unpack_op.py diff --git a/test/deprecated/legacy_test/test_masked_scatter.py b/test/legacy_test/test_masked_scatter.py similarity index 100% rename from test/deprecated/legacy_test/test_masked_scatter.py rename to test/legacy_test/test_masked_scatter.py diff --git a/test/deprecated/legacy_test/test_matmul_op.py b/test/legacy_test/test_matmul_op.py similarity index 100% rename from test/deprecated/legacy_test/test_matmul_op.py rename to test/legacy_test/test_matmul_op.py diff --git a/test/deprecated/legacy_test/test_matmul_v2_op.py b/test/legacy_test/test_matmul_v2_op.py similarity index 100% rename from test/deprecated/legacy_test/test_matmul_v2_op.py rename to test/legacy_test/test_matmul_v2_op.py diff --git a/test/deprecated/legacy_test/test_maxout_op.py b/test/legacy_test/test_maxout_op.py similarity index 100% rename from test/deprecated/legacy_test/test_maxout_op.py rename to test/legacy_test/test_maxout_op.py diff --git a/test/deprecated/legacy_test/test_meshgrid_op.py b/test/legacy_test/test_meshgrid_op.py similarity index 100% rename from test/deprecated/legacy_test/test_meshgrid_op.py rename to test/legacy_test/test_meshgrid_op.py diff --git a/test/deprecated/legacy_test/test_modified_huber_loss_op.py b/test/legacy_test/test_modified_huber_loss_op.py similarity index 100% rename from test/deprecated/legacy_test/test_modified_huber_loss_op.py rename to test/legacy_test/test_modified_huber_loss_op.py diff --git a/test/deprecated/legacy_test/test_mul_op.py b/test/legacy_test/test_mul_op.py similarity index 100% rename from test/deprecated/legacy_test/test_mul_op.py rename to test/legacy_test/test_mul_op.py diff --git a/test/deprecated/legacy_test/test_multi_dot_op.py b/test/legacy_test/test_multi_dot_op.py similarity index 100% rename from test/deprecated/legacy_test/test_multi_dot_op.py rename to test/legacy_test/test_multi_dot_op.py diff --git a/test/deprecated/legacy_test/test_mv_op.py b/test/legacy_test/test_mv_op.py similarity index 100% rename from test/deprecated/legacy_test/test_mv_op.py rename to test/legacy_test/test_mv_op.py diff --git a/test/deprecated/legacy_test/test_nearest_interp_op.py b/test/legacy_test/test_nearest_interp_op.py similarity index 100% rename from test/deprecated/legacy_test/test_nearest_interp_op.py rename to test/legacy_test/test_nearest_interp_op.py diff --git a/test/deprecated/legacy_test/test_nearest_interp_v2_op.py b/test/legacy_test/test_nearest_interp_v2_op.py similarity index 100% rename from test/deprecated/legacy_test/test_nearest_interp_v2_op.py rename to test/legacy_test/test_nearest_interp_v2_op.py diff --git a/test/deprecated/legacy_test/test_ops_nms.py b/test/legacy_test/test_ops_nms.py similarity index 100% rename from test/deprecated/legacy_test/test_ops_nms.py rename to test/legacy_test/test_ops_nms.py diff --git a/test/deprecated/legacy_test/test_overlap_add_op.py b/test/legacy_test/test_overlap_add_op.py similarity index 100% rename from test/deprecated/legacy_test/test_overlap_add_op.py rename to test/legacy_test/test_overlap_add_op.py diff --git a/test/deprecated/legacy_test/test_pad3d_op.py b/test/legacy_test/test_pad3d_op.py similarity index 100% rename from test/deprecated/legacy_test/test_pad3d_op.py rename to test/legacy_test/test_pad3d_op.py diff --git a/test/deprecated/legacy_test/test_paddle_save_load_binary.py b/test/legacy_test/test_paddle_save_load_binary.py similarity index 100% rename from test/deprecated/legacy_test/test_paddle_save_load_binary.py rename to test/legacy_test/test_paddle_save_load_binary.py diff --git a/test/deprecated/legacy_test/test_partial_concat_op.py b/test/legacy_test/test_partial_concat_op.py similarity index 100% rename from test/deprecated/legacy_test/test_partial_concat_op.py rename to test/legacy_test/test_partial_concat_op.py diff --git a/test/deprecated/legacy_test/test_partial_sum_op.py b/test/legacy_test/test_partial_sum_op.py similarity index 100% rename from test/deprecated/legacy_test/test_partial_sum_op.py rename to test/legacy_test/test_partial_sum_op.py diff --git a/test/deprecated/legacy_test/test_pixel_shuffle_op.py b/test/legacy_test/test_pixel_shuffle_op.py similarity index 100% rename from test/deprecated/legacy_test/test_pixel_shuffle_op.py rename to test/legacy_test/test_pixel_shuffle_op.py diff --git a/test/deprecated/legacy_test/test_pool3d_op.py b/test/legacy_test/test_pool3d_op.py similarity index 100% rename from test/deprecated/legacy_test/test_pool3d_op.py rename to test/legacy_test/test_pool3d_op.py diff --git a/test/deprecated/legacy_test/test_put_along_axis_op.py b/test/legacy_test/test_put_along_axis_op.py similarity index 100% rename from test/deprecated/legacy_test/test_put_along_axis_op.py rename to test/legacy_test/test_put_along_axis_op.py diff --git a/test/deprecated/legacy_test/test_qr_op.py b/test/legacy_test/test_qr_op.py similarity index 100% rename from test/deprecated/legacy_test/test_qr_op.py rename to test/legacy_test/test_qr_op.py diff --git a/test/deprecated/legacy_test/test_repeat_interleave_op.py b/test/legacy_test/test_repeat_interleave_op.py similarity index 100% rename from test/deprecated/legacy_test/test_repeat_interleave_op.py rename to test/legacy_test/test_repeat_interleave_op.py diff --git a/test/deprecated/legacy_test/test_reshape_op.py b/test/legacy_test/test_reshape_op.py similarity index 100% rename from test/deprecated/legacy_test/test_reshape_op.py rename to test/legacy_test/test_reshape_op.py diff --git a/test/deprecated/legacy_test/test_reverse_op.py b/test/legacy_test/test_reverse_op.py similarity index 100% rename from test/deprecated/legacy_test/test_reverse_op.py rename to test/legacy_test/test_reverse_op.py diff --git a/test/deprecated/legacy_test/test_roi_align_op.py b/test/legacy_test/test_roi_align_op.py similarity index 100% rename from test/deprecated/legacy_test/test_roi_align_op.py rename to test/legacy_test/test_roi_align_op.py diff --git a/test/deprecated/legacy_test/test_roi_pool_op.py b/test/legacy_test/test_roi_pool_op.py similarity index 100% rename from test/deprecated/legacy_test/test_roi_pool_op.py rename to test/legacy_test/test_roi_pool_op.py diff --git a/test/deprecated/legacy_test/test_roll_op.py b/test/legacy_test/test_roll_op.py similarity index 100% rename from test/deprecated/legacy_test/test_roll_op.py rename to test/legacy_test/test_roll_op.py diff --git a/test/deprecated/legacy_test/test_row_conv_op.py b/test/legacy_test/test_row_conv_op.py similarity index 100% rename from test/deprecated/legacy_test/test_row_conv_op.py rename to test/legacy_test/test_row_conv_op.py diff --git a/test/deprecated/legacy_test/test_save_inference_model_conditional_op.py b/test/legacy_test/test_save_inference_model_conditional_op.py similarity index 100% rename from test/deprecated/legacy_test/test_save_inference_model_conditional_op.py rename to test/legacy_test/test_save_inference_model_conditional_op.py diff --git a/test/deprecated/legacy_test/test_save_model_without_var.py b/test/legacy_test/test_save_model_without_var.py similarity index 100% rename from test/deprecated/legacy_test/test_save_model_without_var.py rename to test/legacy_test/test_save_model_without_var.py diff --git a/test/deprecated/legacy_test/test_scatter_op.py b/test/legacy_test/test_scatter_op.py similarity index 100% rename from test/deprecated/legacy_test/test_scatter_op.py rename to test/legacy_test/test_scatter_op.py diff --git a/test/deprecated/legacy_test/test_selu_op.py b/test/legacy_test/test_selu_op.py similarity index 100% rename from test/deprecated/legacy_test/test_selu_op.py rename to test/legacy_test/test_selu_op.py diff --git a/test/deprecated/legacy_test/test_shuffle_channel_op.py b/test/legacy_test/test_shuffle_channel_op.py similarity index 100% rename from test/deprecated/legacy_test/test_shuffle_channel_op.py rename to test/legacy_test/test_shuffle_channel_op.py diff --git a/test/deprecated/legacy_test/test_sigmoid_cross_entropy_with_logits_grad_with_auto_grad.py b/test/legacy_test/test_sigmoid_cross_entropy_with_logits_grad_with_auto_grad.py similarity index 100% rename from test/deprecated/legacy_test/test_sigmoid_cross_entropy_with_logits_grad_with_auto_grad.py rename to test/legacy_test/test_sigmoid_cross_entropy_with_logits_grad_with_auto_grad.py diff --git a/test/deprecated/legacy_test/test_sign_op.py b/test/legacy_test/test_sign_op.py similarity index 100% rename from test/deprecated/legacy_test/test_sign_op.py rename to test/legacy_test/test_sign_op.py diff --git a/test/deprecated/legacy_test/test_solve_op.py b/test/legacy_test/test_solve_op.py similarity index 100% rename from test/deprecated/legacy_test/test_solve_op.py rename to test/legacy_test/test_solve_op.py diff --git a/test/deprecated/legacy_test/test_spectral_norm_op.py b/test/legacy_test/test_spectral_norm_op.py similarity index 100% rename from test/deprecated/legacy_test/test_spectral_norm_op.py rename to test/legacy_test/test_spectral_norm_op.py diff --git a/test/deprecated/legacy_test/test_split_op.py b/test/legacy_test/test_split_op.py similarity index 100% rename from test/deprecated/legacy_test/test_split_op.py rename to test/legacy_test/test_split_op.py diff --git a/test/deprecated/legacy_test/test_static_save_load_large.py b/test/legacy_test/test_static_save_load_large.py similarity index 100% rename from test/deprecated/legacy_test/test_static_save_load_large.py rename to test/legacy_test/test_static_save_load_large.py diff --git a/test/deprecated/legacy_test/test_stft_op.py b/test/legacy_test/test_stft_op.py similarity index 100% rename from test/deprecated/legacy_test/test_stft_op.py rename to test/legacy_test/test_stft_op.py diff --git a/test/deprecated/legacy_test/test_svd_op.py b/test/legacy_test/test_svd_op.py similarity index 100% rename from test/deprecated/legacy_test/test_svd_op.py rename to test/legacy_test/test_svd_op.py diff --git a/test/deprecated/legacy_test/test_swiglu.py b/test/legacy_test/test_swiglu.py similarity index 100% rename from test/deprecated/legacy_test/test_swiglu.py rename to test/legacy_test/test_swiglu.py diff --git a/test/deprecated/legacy_test/test_temporal_shift_op.py b/test/legacy_test/test_temporal_shift_op.py similarity index 100% rename from test/deprecated/legacy_test/test_temporal_shift_op.py rename to test/legacy_test/test_temporal_shift_op.py diff --git a/test/deprecated/legacy_test/test_top_k_op.py b/test/legacy_test/test_top_k_op.py similarity index 100% rename from test/deprecated/legacy_test/test_top_k_op.py rename to test/legacy_test/test_top_k_op.py diff --git a/test/deprecated/legacy_test/test_top_k_v2_op.py b/test/legacy_test/test_top_k_v2_op.py similarity index 100% rename from test/deprecated/legacy_test/test_top_k_v2_op.py rename to test/legacy_test/test_top_k_v2_op.py diff --git a/test/deprecated/legacy_test/test_trace_op.py b/test/legacy_test/test_trace_op.py similarity index 100% rename from test/deprecated/legacy_test/test_trace_op.py rename to test/legacy_test/test_trace_op.py diff --git a/test/deprecated/legacy_test/test_triangular_solve_op.py b/test/legacy_test/test_triangular_solve_op.py similarity index 100% rename from test/deprecated/legacy_test/test_triangular_solve_op.py rename to test/legacy_test/test_triangular_solve_op.py diff --git a/test/deprecated/legacy_test/test_trilinear_interp_op.py b/test/legacy_test/test_trilinear_interp_op.py similarity index 100% rename from test/deprecated/legacy_test/test_trilinear_interp_op.py rename to test/legacy_test/test_trilinear_interp_op.py diff --git a/test/deprecated/legacy_test/test_trilinear_interp_v2_op.py b/test/legacy_test/test_trilinear_interp_v2_op.py similarity index 100% rename from test/deprecated/legacy_test/test_trilinear_interp_v2_op.py rename to test/legacy_test/test_trilinear_interp_v2_op.py diff --git a/test/deprecated/legacy_test/test_trunc_op.py b/test/legacy_test/test_trunc_op.py similarity index 100% rename from test/deprecated/legacy_test/test_trunc_op.py rename to test/legacy_test/test_trunc_op.py diff --git a/test/deprecated/legacy_test/test_unfold_op.py b/test/legacy_test/test_unfold_op.py similarity index 100% rename from test/deprecated/legacy_test/test_unfold_op.py rename to test/legacy_test/test_unfold_op.py diff --git a/test/deprecated/legacy_test/test_unique_consecutive_op.py b/test/legacy_test/test_unique_consecutive_op.py similarity index 100% rename from test/deprecated/legacy_test/test_unique_consecutive_op.py rename to test/legacy_test/test_unique_consecutive_op.py diff --git a/test/deprecated/legacy_test/test_unpool3d_op.py b/test/legacy_test/test_unpool3d_op.py similarity index 100% rename from test/deprecated/legacy_test/test_unpool3d_op.py rename to test/legacy_test/test_unpool3d_op.py diff --git a/test/deprecated/legacy_test/test_unpool_op.py b/test/legacy_test/test_unpool_op.py similarity index 100% rename from test/deprecated/legacy_test/test_unpool_op.py rename to test/legacy_test/test_unpool_op.py diff --git a/test/deprecated/legacy_test/test_unstack_op.py b/test/legacy_test/test_unstack_op.py similarity index 100% rename from test/deprecated/legacy_test/test_unstack_op.py rename to test/legacy_test/test_unstack_op.py diff --git a/test/deprecated/legacy_test/test_yolov3_loss_op.py b/test/legacy_test/test_yolov3_loss_op.py similarity index 100% rename from test/deprecated/legacy_test/test_yolov3_loss_op.py rename to test/legacy_test/test_yolov3_loss_op.py