diff --git a/python/paddle/fluid/tests/unittests/mkldnn/test_activation_bf16_mkldnn_op.py b/python/paddle/fluid/tests/unittests/mkldnn/test_activation_bf16_mkldnn_op.py index 318dd22c62f08061e763ed75f199c424fc8b609c..9c550fc25f9cd271b07bcd020bb9e908ad03c9c3 100644 --- a/python/paddle/fluid/tests/unittests/mkldnn/test_activation_bf16_mkldnn_op.py +++ b/python/paddle/fluid/tests/unittests/mkldnn/test_activation_bf16_mkldnn_op.py @@ -16,9 +16,9 @@ import six import abc import unittest import numpy as np -from scipy.special import expit, erf +from scipy.special import erf import paddle.fluid.core as core -from paddle.fluid.tests.unittests.op_test import OpTest, OpTestTool, convert_float_to_uint16 +from paddle.fluid.tests.unittests.op_test import OpTestTool, convert_float_to_uint16 from paddle.fluid.tests.unittests.test_activation_op import TestActivation from paddle.fluid.tests.unittests.test_gelu_op import gelu diff --git a/python/paddle/fluid/tests/unittests/mkldnn/test_activation_mkldnn_op.py b/python/paddle/fluid/tests/unittests/mkldnn/test_activation_mkldnn_op.py index 2aaba4521dd67739e1ced02e9d2c6f52d536ad7b..0ca003b45f2ead713cef0d60168b8dddb50c62b3 100644 --- a/python/paddle/fluid/tests/unittests/mkldnn/test_activation_mkldnn_op.py +++ b/python/paddle/fluid/tests/unittests/mkldnn/test_activation_mkldnn_op.py @@ -14,9 +14,9 @@ import unittest import numpy as np -from scipy.special import expit, erf +from scipy.special import expit import paddle.fluid.core as core -from paddle.fluid.tests.unittests.op_test import OpTest, OpTestTool, convert_float_to_uint16, skip_check_grad_ci +from paddle.fluid.tests.unittests.op_test import OpTest, convert_float_to_uint16 from paddle.fluid.tests.unittests.test_activation_op import TestActivation, TestRelu, TestTanh, TestSqrt, TestAbs, TestLeakyRelu, TestSwish, TestHardSwish, TestRelu6, TestSigmoid from paddle.fluid.tests.unittests.test_gelu_op import gelu from mkldnn_op_test import check_if_mkldnn_primitives_exist_in_bwd diff --git a/python/paddle/fluid/tests/unittests/mkldnn/test_batch_norm_mkldnn_op.py b/python/paddle/fluid/tests/unittests/mkldnn/test_batch_norm_mkldnn_op.py index c5ab11eb00f12fa3f832d62db140105af017b22c..f8c5ca3d1be890e30510a014dc85017ec9f7fa5a 100644 --- a/python/paddle/fluid/tests/unittests/mkldnn/test_batch_norm_mkldnn_op.py +++ b/python/paddle/fluid/tests/unittests/mkldnn/test_batch_norm_mkldnn_op.py @@ -15,10 +15,7 @@ import unittest import numpy as np import paddle.fluid.core as core -from paddle.fluid.op import Operator -import paddle.fluid as fluid -from paddle.fluid.tests.unittests.op_test import OpTest, _set_use_system_allocator -from paddle.fluid.framework import grad_var_name +from paddle.fluid.tests.unittests.op_test import _set_use_system_allocator from paddle.fluid.tests.unittests.test_batch_norm_op import TestBatchNormOpInference, TestBatchNormOpTraining, _reference_training, _reference_grad from mkldnn_op_test import check_if_mkldnn_batchnorm_primitives_exist_in_bwd diff --git a/python/paddle/fluid/tests/unittests/mkldnn/test_bilinear_interp_mkldnn_op.py b/python/paddle/fluid/tests/unittests/mkldnn/test_bilinear_interp_mkldnn_op.py index 4fadc9484cbe5b183f928bcb969af5f0404a9518..2a91d6257300d2aed389ce5e2f2480baf568268f 100644 --- a/python/paddle/fluid/tests/unittests/mkldnn/test_bilinear_interp_mkldnn_op.py +++ b/python/paddle/fluid/tests/unittests/mkldnn/test_bilinear_interp_mkldnn_op.py @@ -15,9 +15,6 @@ import unittest import numpy as np import math -import paddle -import paddle.fluid.core as core -import paddle.fluid as fluid from paddle.fluid.tests.unittests.op_test import OpTest from paddle.fluid.tests.unittests.op_test import skip_check_grad_ci diff --git a/python/paddle/fluid/tests/unittests/mkldnn/test_bilinear_interp_v2_mkldnn_op.py b/python/paddle/fluid/tests/unittests/mkldnn/test_bilinear_interp_v2_mkldnn_op.py index 67c34d7a308d43769b9fe28402aeffad85c6dff0..55f57764b12f3b93790493d9f121357c87ec868d 100644 --- a/python/paddle/fluid/tests/unittests/mkldnn/test_bilinear_interp_v2_mkldnn_op.py +++ b/python/paddle/fluid/tests/unittests/mkldnn/test_bilinear_interp_v2_mkldnn_op.py @@ -15,9 +15,6 @@ import unittest import numpy as np import math -import paddle -import paddle.fluid.core as core -import paddle.fluid as fluid from paddle.fluid.tests.unittests.op_test import OpTest from paddle.fluid.tests.unittests.op_test import skip_check_grad_ci diff --git a/python/paddle/fluid/tests/unittests/mkldnn/test_cast_mkldnn_op.py b/python/paddle/fluid/tests/unittests/mkldnn/test_cast_mkldnn_op.py index 01abaa453f6ccd2a5c46497fa8433f3355bebbee..8f7267d212ebd771ccf772d1ce7945300d94d41a 100644 --- a/python/paddle/fluid/tests/unittests/mkldnn/test_cast_mkldnn_op.py +++ b/python/paddle/fluid/tests/unittests/mkldnn/test_cast_mkldnn_op.py @@ -17,8 +17,6 @@ import numpy as np import paddle import paddle.fluid.core as core -import paddle.fluid as fluid -from paddle.fluid import compiler, Program, program_guard from paddle.fluid.tests.unittests.op_test import OpTest, convert_float_to_uint16 diff --git a/python/paddle/fluid/tests/unittests/mkldnn/test_clip_mkldnn_op.py b/python/paddle/fluid/tests/unittests/mkldnn/test_clip_mkldnn_op.py index d3179373ff7d63a481ded9b4889491ab1abf9502..b9a9119e5adfa315d571f1219a5b23b8533f6409 100644 --- a/python/paddle/fluid/tests/unittests/mkldnn/test_clip_mkldnn_op.py +++ b/python/paddle/fluid/tests/unittests/mkldnn/test_clip_mkldnn_op.py @@ -16,7 +16,6 @@ import unittest import numpy as np from paddle.fluid.tests.unittests.op_test import OpTest, OpTestTool, convert_float_to_uint16 import paddle -import paddle.fluid as fluid import paddle.fluid.core as core diff --git a/python/paddle/fluid/tests/unittests/mkldnn/test_concat_bf16_mkldnn_op.py b/python/paddle/fluid/tests/unittests/mkldnn/test_concat_bf16_mkldnn_op.py index 3e2794d81e13a52742a8a47e4ea55d435602e1e6..f10b04bdb5be2322db009496e2834ca74099f448 100644 --- a/python/paddle/fluid/tests/unittests/mkldnn/test_concat_bf16_mkldnn_op.py +++ b/python/paddle/fluid/tests/unittests/mkldnn/test_concat_bf16_mkldnn_op.py @@ -14,7 +14,6 @@ import unittest import numpy as np -import struct import paddle.fluid.core as core from paddle.fluid.tests.unittests.op_test import OpTest, convert_float_to_uint16 diff --git a/python/paddle/fluid/tests/unittests/mkldnn/test_concat_mkldnn_op.py b/python/paddle/fluid/tests/unittests/mkldnn/test_concat_mkldnn_op.py index 1125a2c907d3fb1d8e8d7ef08ac8105f135af7af..1788923e20b2e0ada564165fb1930b615248fcec 100644 --- a/python/paddle/fluid/tests/unittests/mkldnn/test_concat_mkldnn_op.py +++ b/python/paddle/fluid/tests/unittests/mkldnn/test_concat_mkldnn_op.py @@ -14,10 +14,9 @@ import unittest import numpy as np -import struct import paddle.fluid.core as core -from paddle.fluid.tests.unittests.op_test import OpTest, convert_float_to_uint16 +from paddle.fluid.tests.unittests.op_test import OpTest from paddle import enable_static diff --git a/python/paddle/fluid/tests/unittests/mkldnn/test_conv2d_bf16_mkldnn_op.py b/python/paddle/fluid/tests/unittests/mkldnn/test_conv2d_bf16_mkldnn_op.py index a0ef3d430c937511ca9b34bf3430b157b5ca810e..e4f23f195d2f600b720d495f14740db09dae3533 100644 --- a/python/paddle/fluid/tests/unittests/mkldnn/test_conv2d_bf16_mkldnn_op.py +++ b/python/paddle/fluid/tests/unittests/mkldnn/test_conv2d_bf16_mkldnn_op.py @@ -14,7 +14,6 @@ import unittest import numpy as np -import struct import paddle.fluid.core as core from paddle.fluid.tests.unittests.op_test import OpTest, convert_float_to_uint16, OpTestTool diff --git a/python/paddle/fluid/tests/unittests/mkldnn/test_conv2d_mkldnn_op.py b/python/paddle/fluid/tests/unittests/mkldnn/test_conv2d_mkldnn_op.py index ab4db3f964fe70ada083e448a1fe86645039e940..d3e9bdde1a6893484a2d4e2cd5d8b96e66b2b0e5 100644 --- a/python/paddle/fluid/tests/unittests/mkldnn/test_conv2d_mkldnn_op.py +++ b/python/paddle/fluid/tests/unittests/mkldnn/test_conv2d_mkldnn_op.py @@ -12,11 +12,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -import os import unittest import numpy as np -import paddle.fluid.core as core from paddle.fluid.tests.unittests.op_test import OpTest, skip_check_grad_ci from paddle.fluid.tests.unittests.test_conv2d_op import TestConv2DOp, TestConv2DOp_v2 diff --git a/python/paddle/fluid/tests/unittests/mkldnn/test_conv2d_transpose_mkldnn_op.py b/python/paddle/fluid/tests/unittests/mkldnn/test_conv2d_transpose_mkldnn_op.py index a9400659092aa448559c02c67e36f64b18607862..081f70a02e3353fc712db5f38fb2f6960584a1c5 100644 --- a/python/paddle/fluid/tests/unittests/mkldnn/test_conv2d_transpose_mkldnn_op.py +++ b/python/paddle/fluid/tests/unittests/mkldnn/test_conv2d_transpose_mkldnn_op.py @@ -14,10 +14,9 @@ import unittest import numpy as np -import paddle.fluid.core as core from paddle.fluid.tests.unittests.op_test import OpTest from paddle import enable_static -from paddle.fluid.tests.unittests.test_conv2d_transpose_op import conv2dtranspose_forward_naive, TestConv2DTransposeOp +from paddle.fluid.tests.unittests.test_conv2d_transpose_op import TestConv2DTransposeOp def conv2d_bias_naive(out, bias): diff --git a/python/paddle/fluid/tests/unittests/mkldnn/test_conv3d_mkldnn_op.py b/python/paddle/fluid/tests/unittests/mkldnn/test_conv3d_mkldnn_op.py index 7667a93c3e1e47fd3ff6971ed7035e83f43e05ee..6e31912a909b7c5a36c284fd326a7bebdcdc35c9 100644 --- a/python/paddle/fluid/tests/unittests/mkldnn/test_conv3d_mkldnn_op.py +++ b/python/paddle/fluid/tests/unittests/mkldnn/test_conv3d_mkldnn_op.py @@ -14,7 +14,7 @@ import unittest import numpy as np -from paddle.fluid.tests.unittests.test_conv3d_op import TestConv3DOp, TestCase1, TestWithGroup1, TestWithGroup2, TestWith1x1, TestWithInput1x1Filter1x1, TestConv3DOp_2 +from paddle.fluid.tests.unittests.test_conv3d_op import TestCase1, TestConv3DOp, TestWith1x1, TestWithGroup1, TestWithGroup2, TestWithInput1x1Filter1x1 class TestMKLDNN(TestConv3DOp): diff --git a/python/paddle/fluid/tests/unittests/mkldnn/test_expand_v2_mkldnn_op.py b/python/paddle/fluid/tests/unittests/mkldnn/test_expand_v2_mkldnn_op.py index b782937a594242d767d25c6b5fccedc990467beb..cf98324809d333024b1e64bfe891a83bbb1398f2 100644 --- a/python/paddle/fluid/tests/unittests/mkldnn/test_expand_v2_mkldnn_op.py +++ b/python/paddle/fluid/tests/unittests/mkldnn/test_expand_v2_mkldnn_op.py @@ -15,8 +15,7 @@ import unittest import numpy as np import paddle -import paddle.fluid as fluid -from paddle.fluid import compiler, Program, program_guard, core +from paddle.fluid import core from paddle.fluid.tests.unittests.op_test import OpTest, OpTestTool, convert_float_to_uint16 diff --git a/python/paddle/fluid/tests/unittests/mkldnn/test_fusion_gru_bf16_mkldnn_op.py b/python/paddle/fluid/tests/unittests/mkldnn/test_fusion_gru_bf16_mkldnn_op.py index 7bc0b3ed8d07a2e67557aac0fa3e129b78ffc82a..62759913e84527bdbc92fb758a966e115b7d1331 100644 --- a/python/paddle/fluid/tests/unittests/mkldnn/test_fusion_gru_bf16_mkldnn_op.py +++ b/python/paddle/fluid/tests/unittests/mkldnn/test_fusion_gru_bf16_mkldnn_op.py @@ -14,11 +14,10 @@ import unittest import numpy as np -import struct import paddle.fluid.core as core from paddle.fluid.tests.unittests.op_test import OpTest, convert_float_to_uint16 from paddle.fluid.tests.unittests.test_fusion_gru_op import fusion_gru -from paddle.fluid.tests.unittests.test_fusion_lstm_op import fc, ACTIVATION +from paddle.fluid.tests.unittests.test_fusion_lstm_op import ACTIVATION @unittest.skipIf(not core.supports_bfloat16(), diff --git a/python/paddle/fluid/tests/unittests/mkldnn/test_fusion_gru_int8_mkldnn_op.py b/python/paddle/fluid/tests/unittests/mkldnn/test_fusion_gru_int8_mkldnn_op.py index fee53dc348366ced396e4c1e04c36578be1a7714..9cbbddd6a42af2d08c0c27434124b12a6fde6481 100644 --- a/python/paddle/fluid/tests/unittests/mkldnn/test_fusion_gru_int8_mkldnn_op.py +++ b/python/paddle/fluid/tests/unittests/mkldnn/test_fusion_gru_int8_mkldnn_op.py @@ -16,7 +16,7 @@ import unittest import numpy as np from paddle.fluid.tests.unittests.op_test import OpTest from paddle.fluid.tests.unittests.test_fusion_gru_op import fusion_gru -from paddle.fluid.tests.unittests.test_fusion_lstm_op import fc, ACTIVATION +from paddle.fluid.tests.unittests.test_fusion_lstm_op import ACTIVATION class TestFusionGRUINT8MKLDNNOp(OpTest): diff --git a/python/paddle/fluid/tests/unittests/mkldnn/test_fusion_gru_mkldnn_op.py b/python/paddle/fluid/tests/unittests/mkldnn/test_fusion_gru_mkldnn_op.py index 2910a2c05c310879618a37bd5556d6f2f77c47c6..e47105e733cca4921ac3b61ee1f2aa4fd45e84ac 100644 --- a/python/paddle/fluid/tests/unittests/mkldnn/test_fusion_gru_mkldnn_op.py +++ b/python/paddle/fluid/tests/unittests/mkldnn/test_fusion_gru_mkldnn_op.py @@ -13,7 +13,6 @@ # limitations under the License. import unittest -import numpy as np from paddle.fluid.tests.unittests.test_fusion_gru_op import TestFusionGRUOp diff --git a/python/paddle/fluid/tests/unittests/mkldnn/test_fusion_lstm_bf16_mkldnn_op.py b/python/paddle/fluid/tests/unittests/mkldnn/test_fusion_lstm_bf16_mkldnn_op.py index 978d1d0059431a950ffb7286d40eeeb36e50e084..a2fdf54da9ded87a6d236999198827cc1ce048f0 100644 --- a/python/paddle/fluid/tests/unittests/mkldnn/test_fusion_lstm_bf16_mkldnn_op.py +++ b/python/paddle/fluid/tests/unittests/mkldnn/test_fusion_lstm_bf16_mkldnn_op.py @@ -14,11 +14,9 @@ import unittest import numpy as np -import struct import paddle.fluid.core as core -from paddle.fluid.tests.unittests.op_test import OpTest, convert_float_to_uint16, convert_uint16_to_float -from paddle.fluid.tests.unittests.test_fusion_lstm_op import TestFusionLSTMOp, fc, ACTIVATION, fusion_lstm -from paddle.fluid.tests.unittests.test_fusion_gru_op import fusion_gru +from paddle.fluid.tests.unittests.op_test import OpTest, convert_float_to_uint16 +from paddle.fluid.tests.unittests.test_fusion_lstm_op import ACTIVATION, fusion_lstm @unittest.skipIf(not core.supports_bfloat16(), diff --git a/python/paddle/fluid/tests/unittests/mkldnn/test_fusion_lstm_int8_mkldnn_op.py b/python/paddle/fluid/tests/unittests/mkldnn/test_fusion_lstm_int8_mkldnn_op.py index 8d3b4db1714873fc4221f1884495d42550be4cc3..968c01faa17b0f0cf0ba9b0149242c9ff4b8f1b9 100644 --- a/python/paddle/fluid/tests/unittests/mkldnn/test_fusion_lstm_int8_mkldnn_op.py +++ b/python/paddle/fluid/tests/unittests/mkldnn/test_fusion_lstm_int8_mkldnn_op.py @@ -15,7 +15,7 @@ import unittest import numpy as np from paddle.fluid.tests.unittests.op_test import OpTest -from paddle.fluid.tests.unittests.test_fusion_lstm_op import fc, ACTIVATION, fusion_lstm +from paddle.fluid.tests.unittests.test_fusion_lstm_op import ACTIVATION, fusion_lstm class TestFusionLSTMINT8MKLDNNOp(OpTest): diff --git a/python/paddle/fluid/tests/unittests/mkldnn/test_fusion_lstm_mkldnn_op.py b/python/paddle/fluid/tests/unittests/mkldnn/test_fusion_lstm_mkldnn_op.py index 6c48ba9b46a7b5be9628768bda7b47785875d497..5ce307fe35ed59e7a7597032b387505cf7dfdeeb 100644 --- a/python/paddle/fluid/tests/unittests/mkldnn/test_fusion_lstm_mkldnn_op.py +++ b/python/paddle/fluid/tests/unittests/mkldnn/test_fusion_lstm_mkldnn_op.py @@ -13,7 +13,6 @@ # limitations under the License. import unittest -import numpy as np from paddle.fluid.tests.unittests.test_fusion_lstm_op import TestFusionLSTMOp diff --git a/python/paddle/fluid/tests/unittests/mkldnn/test_layer_norm_bf16_mkldnn_op.py b/python/paddle/fluid/tests/unittests/mkldnn/test_layer_norm_bf16_mkldnn_op.py index 925a7ffe02b7afeb9431f898f88706bb668f5b80..ab4cc17a713c667bcb427b9d46d2c95624ec770b 100644 --- a/python/paddle/fluid/tests/unittests/mkldnn/test_layer_norm_bf16_mkldnn_op.py +++ b/python/paddle/fluid/tests/unittests/mkldnn/test_layer_norm_bf16_mkldnn_op.py @@ -24,7 +24,7 @@ from functools import reduce from paddle.fluid.tests.unittests.mkldnn.test_layer_norm_mkldnn_op import TestLayerNormMKLDNNOp from paddle.fluid.tests.unittests.mkldnn.test_layer_norm_mkldnn_op import _reference_layer_norm_naive -from paddle.fluid.tests.unittests.op_test import OpTest, convert_float_to_uint16 +from paddle.fluid.tests.unittests.op_test import convert_float_to_uint16 from paddle.fluid.tests.unittests.op_test import _set_use_system_allocator np.random.random(123) diff --git a/python/paddle/fluid/tests/unittests/mkldnn/test_lrn_mkldnn_op.py b/python/paddle/fluid/tests/unittests/mkldnn/test_lrn_mkldnn_op.py index 8d4dbd0064f29e6ef28d761dff1dd9addeadd1e8..8f3913a86f421e7a9895183102456bda516cb9f0 100644 --- a/python/paddle/fluid/tests/unittests/mkldnn/test_lrn_mkldnn_op.py +++ b/python/paddle/fluid/tests/unittests/mkldnn/test_lrn_mkldnn_op.py @@ -14,7 +14,6 @@ import unittest from paddle.fluid.tests.unittests.test_lrn_op import TestLRNOp -import paddle.fluid as fluid class TestLRNMKLDNNOp(TestLRNOp): diff --git a/python/paddle/fluid/tests/unittests/mkldnn/test_matmul_bf16_mkldnn_op.py b/python/paddle/fluid/tests/unittests/mkldnn/test_matmul_bf16_mkldnn_op.py index 5d021b86449a35812808d037ffe14f168cfa2ad9..8940502b8066222125ba14883a427077ade41bbd 100644 --- a/python/paddle/fluid/tests/unittests/mkldnn/test_matmul_bf16_mkldnn_op.py +++ b/python/paddle/fluid/tests/unittests/mkldnn/test_matmul_bf16_mkldnn_op.py @@ -13,10 +13,9 @@ # limitations under the License. import unittest -import os import numpy as np import paddle.fluid.core as core -from paddle.fluid.tests.unittests.op_test import OpTest, skip_check_grad_ci, convert_float_to_uint16 +from paddle.fluid.tests.unittests.op_test import OpTest, convert_float_to_uint16 from paddle import enable_static diff --git a/python/paddle/fluid/tests/unittests/mkldnn/test_matmul_v2_mkldnn_op.py b/python/paddle/fluid/tests/unittests/mkldnn/test_matmul_v2_mkldnn_op.py index 0d0ce7bc6ab4be1909113e471bce7366af5b47a3..5038114582116a0a8079c035b51d59f213e3ecb2 100644 --- a/python/paddle/fluid/tests/unittests/mkldnn/test_matmul_v2_mkldnn_op.py +++ b/python/paddle/fluid/tests/unittests/mkldnn/test_matmul_v2_mkldnn_op.py @@ -13,14 +13,11 @@ # limitations under the License. import unittest -from functools import reduce import numpy as np from paddle.fluid.tests.unittests.op_test import OpTest, OpTestTool, convert_float_to_uint16 import paddle.fluid.core as core import paddle -import paddle.fluid as fluid -import paddle.fluid.framework as framework from paddle.fluid.tests.unittests.mkldnn.test_matmul_mkldnn_op import ( TestMatMulOpTransposeReshapeEmptyFloat, TestMatMulOpTransposeReshapeBasicFloat, diff --git a/python/paddle/fluid/tests/unittests/mkldnn/test_mul_mkldnn_op.py b/python/paddle/fluid/tests/unittests/mkldnn/test_mul_mkldnn_op.py index e831e57b0f235e2b98ab00b3bce6ffe00db772b9..85a17094fdc362ed98265f0f8041b68139af046f 100644 --- a/python/paddle/fluid/tests/unittests/mkldnn/test_mul_mkldnn_op.py +++ b/python/paddle/fluid/tests/unittests/mkldnn/test_mul_mkldnn_op.py @@ -14,7 +14,6 @@ import unittest import numpy as np -from numpy.matrixlib import defmatrix import paddle import paddle.fluid.core as core from paddle.fluid.tests.unittests.op_test import OpTest, convert_float_to_uint16, OpTestTool diff --git a/python/paddle/fluid/tests/unittests/mkldnn/test_multi_gru_mkldnn_op.py b/python/paddle/fluid/tests/unittests/mkldnn/test_multi_gru_mkldnn_op.py index 4c11712947540b94ecd6085e88066cefaf96b7a8..a5f4583c3e5f62ab99cf92aaa3a610c5ac8738cc 100644 --- a/python/paddle/fluid/tests/unittests/mkldnn/test_multi_gru_mkldnn_op.py +++ b/python/paddle/fluid/tests/unittests/mkldnn/test_multi_gru_mkldnn_op.py @@ -16,7 +16,6 @@ import unittest import numpy as np from paddle.fluid.tests.unittests.op_test import OpTest from paddle.fluid.tests.unittests.test_fusion_gru_op import fusion_gru, ACTIVATION -from paddle.fluid.dygraph.base import disable_dygraph def multi_gru( diff --git a/python/paddle/fluid/tests/unittests/mkldnn/test_onnx_format_quantization_mobilenetv1.py b/python/paddle/fluid/tests/unittests/mkldnn/test_onnx_format_quantization_mobilenetv1.py index 82c3338fab54cbc069a8f9c81acc0e592bb6e8b6..e0b90b278a258744b41674d2338b42f40f0f92ed 100755 --- a/python/paddle/fluid/tests/unittests/mkldnn/test_onnx_format_quantization_mobilenetv1.py +++ b/python/paddle/fluid/tests/unittests/mkldnn/test_onnx_format_quantization_mobilenetv1.py @@ -16,12 +16,10 @@ import os import time import sys import random -import math import functools -import contextlib import tempfile import numpy as np -from PIL import Image, ImageEnhance +from PIL import Image import paddle import paddle.fluid as fluid from paddle.dataset.common import download @@ -158,7 +156,6 @@ class TestPostTrainingQuantization(unittest.TestCase): def tearDown(self): self.root_path.cleanup() - pass def cache_unzipping(self, target_folder, zip_path): if not os.path.exists(target_folder): diff --git a/python/paddle/fluid/tests/unittests/mkldnn/test_pool2d_int8_mkldnn_op.py b/python/paddle/fluid/tests/unittests/mkldnn/test_pool2d_int8_mkldnn_op.py index 4511cda0cd4d8a70376b89cb6d0f475a8d2b549b..27595afac1f5489e2b60decba23ba7a194469fbf 100644 --- a/python/paddle/fluid/tests/unittests/mkldnn/test_pool2d_int8_mkldnn_op.py +++ b/python/paddle/fluid/tests/unittests/mkldnn/test_pool2d_int8_mkldnn_op.py @@ -17,7 +17,7 @@ import numpy as np import paddle.fluid.core as core from paddle.fluid.tests.unittests.op_test import OpTest -from paddle.fluid.tests.unittests.test_pool2d_op import TestPool2D_Op, avg_pool2D_forward_naive, max_pool2D_forward_naive +from paddle.fluid.tests.unittests.test_pool2d_op import TestPool2D_Op, max_pool2D_forward_naive class TestPool2DMKLDNNInt8_Op(TestPool2D_Op): diff --git a/python/paddle/fluid/tests/unittests/mkldnn/test_reduce_bf16_mkldnn_op.py b/python/paddle/fluid/tests/unittests/mkldnn/test_reduce_bf16_mkldnn_op.py index 4aa921e527fc8a0eceba73bfef9342ac456bb0c4..12b8a468b46f5272b0194b9795fa9786444a7562 100644 --- a/python/paddle/fluid/tests/unittests/mkldnn/test_reduce_bf16_mkldnn_op.py +++ b/python/paddle/fluid/tests/unittests/mkldnn/test_reduce_bf16_mkldnn_op.py @@ -16,7 +16,6 @@ import unittest import numpy as np from paddle.fluid.tests.unittests.op_test import OpTestTool, OpTest, skip_check_grad_ci, convert_float_to_uint16 import paddle.fluid.core as core -import paddle.fluid as fluid import paddle paddle.enable_static() diff --git a/python/paddle/fluid/tests/unittests/mkldnn/test_reduce_mkldnn_op.py b/python/paddle/fluid/tests/unittests/mkldnn/test_reduce_mkldnn_op.py index 23687aec9ef29a19d117a7d60d9b247ce71f22d7..93e81070cb669253b3f65474d6f09a0b9c4f2475 100644 --- a/python/paddle/fluid/tests/unittests/mkldnn/test_reduce_mkldnn_op.py +++ b/python/paddle/fluid/tests/unittests/mkldnn/test_reduce_mkldnn_op.py @@ -15,7 +15,6 @@ import unittest import numpy as np from paddle.fluid.tests.unittests.op_test import OpTest, OpTestTool, skip_check_grad_ci -import paddle.fluid as fluid import paddle diff --git a/python/paddle/fluid/tests/unittests/mkldnn/test_reshape_bf16_op.py b/python/paddle/fluid/tests/unittests/mkldnn/test_reshape_bf16_op.py index 5ae5529e0145b525898a16ec642077ea60b04a7e..7fbdf66ee7d7525862dc14dcdad0edc4fc89b0b1 100644 --- a/python/paddle/fluid/tests/unittests/mkldnn/test_reshape_bf16_op.py +++ b/python/paddle/fluid/tests/unittests/mkldnn/test_reshape_bf16_op.py @@ -14,7 +14,6 @@ import unittest import numpy as np -import struct import paddle.fluid.core as core from paddle.fluid.tests.unittests.op_test import OpTest, convert_float_to_uint16 diff --git a/python/paddle/fluid/tests/unittests/mkldnn/test_scale_bf16_mkldnn_op.py b/python/paddle/fluid/tests/unittests/mkldnn/test_scale_bf16_mkldnn_op.py index 708d5ab8c5848a585a836ab462ee2b634627f8ed..18224e07d42b5c649846a03b9f78fbfb522fd4e1 100644 --- a/python/paddle/fluid/tests/unittests/mkldnn/test_scale_bf16_mkldnn_op.py +++ b/python/paddle/fluid/tests/unittests/mkldnn/test_scale_bf16_mkldnn_op.py @@ -16,7 +16,6 @@ import unittest import numpy as np from paddle.fluid.tests.unittests.op_test import OpTest, convert_float_to_uint16 import paddle -import paddle.fluid as fluid import paddle.fluid.core as core diff --git a/python/paddle/fluid/tests/unittests/mkldnn/test_scale_mkldnn_op.py b/python/paddle/fluid/tests/unittests/mkldnn/test_scale_mkldnn_op.py index c74349247f71213345beafe8dce300f00a2d27cf..9fcbb98dfa287fd8192e6dff7dac4e6ceae1317d 100644 --- a/python/paddle/fluid/tests/unittests/mkldnn/test_scale_mkldnn_op.py +++ b/python/paddle/fluid/tests/unittests/mkldnn/test_scale_mkldnn_op.py @@ -16,7 +16,6 @@ import unittest import numpy as np from paddle.fluid.tests.unittests.op_test import OpTest import paddle -import paddle.fluid as fluid class TestScaleOp(OpTest): diff --git a/python/paddle/fluid/tests/unittests/mkldnn/test_shape_mkldnn_op.py b/python/paddle/fluid/tests/unittests/mkldnn/test_shape_mkldnn_op.py index f267f140ef26dc556fa9e051f3e48b7eeda9c1a6..573d4a9b2cf22a2ed9783274e38420a6ab8e7c78 100644 --- a/python/paddle/fluid/tests/unittests/mkldnn/test_shape_mkldnn_op.py +++ b/python/paddle/fluid/tests/unittests/mkldnn/test_shape_mkldnn_op.py @@ -17,7 +17,6 @@ import numpy as np from paddle.fluid.tests.unittests.op_test import OpTest, OpTestTool import paddle from paddle.fluid import core -from paddle.fluid.op import Operator @OpTestTool.skip_if_not_cpu_bf16() diff --git a/python/paddle/fluid/tests/unittests/mkldnn/test_shuffle_channel_mkldnn_op.py b/python/paddle/fluid/tests/unittests/mkldnn/test_shuffle_channel_mkldnn_op.py index 6d3a4d8a0df84882dba25521a364d26011645666..0ed91e959242b252872491ada6d8ff62ce6709ee 100644 --- a/python/paddle/fluid/tests/unittests/mkldnn/test_shuffle_channel_mkldnn_op.py +++ b/python/paddle/fluid/tests/unittests/mkldnn/test_shuffle_channel_mkldnn_op.py @@ -16,7 +16,6 @@ import unittest import numpy as np from paddle.fluid.tests.unittests.op_test import OpTest, OpTestTool import paddle -import paddle.fluid as fluid import paddle.fluid.core as core diff --git a/python/paddle/fluid/tests/unittests/mkldnn/test_slice_mkldnn_op.py b/python/paddle/fluid/tests/unittests/mkldnn/test_slice_mkldnn_op.py index 2a57a71e55f7dcac156ea344e734ad8d5981ac7a..0812f4da8b275afe76704907d347980911502d5c 100644 --- a/python/paddle/fluid/tests/unittests/mkldnn/test_slice_mkldnn_op.py +++ b/python/paddle/fluid/tests/unittests/mkldnn/test_slice_mkldnn_op.py @@ -16,8 +16,6 @@ import unittest import numpy as np import paddle.fluid.core as core from paddle.fluid.tests.unittests.op_test import OpTest, OpTestTool, convert_float_to_uint16 -import paddle.fluid as fluid -import paddle.fluid.layers as layers import paddle diff --git a/python/paddle/fluid/tests/unittests/mkldnn/test_softplus_mkldnn_op.py b/python/paddle/fluid/tests/unittests/mkldnn/test_softplus_mkldnn_op.py index 7952275ea052554cf6919b36cb2b28cf06981189..db7eeb88f1d0de0c7a040f125f69564aad152395 100644 --- a/python/paddle/fluid/tests/unittests/mkldnn/test_softplus_mkldnn_op.py +++ b/python/paddle/fluid/tests/unittests/mkldnn/test_softplus_mkldnn_op.py @@ -16,9 +16,6 @@ import unittest import numpy as np from paddle.fluid.tests.unittests.op_test import OpTest, OpTestTool, convert_float_to_uint16 import paddle -import paddle.fluid as fluid -import paddle.fluid.core as core -from paddle.fluid.framework import _current_expected_place def ref_softplus(x, beta, threshold): diff --git a/python/paddle/fluid/tests/unittests/mkldnn/test_split_bf16_mkldnn_op.py b/python/paddle/fluid/tests/unittests/mkldnn/test_split_bf16_mkldnn_op.py index f57a72f543f4bf63e58acd2bfb7a6e74e6c1c8a1..56416629d771d0828cca3a1234a59ad2f636a641 100644 --- a/python/paddle/fluid/tests/unittests/mkldnn/test_split_bf16_mkldnn_op.py +++ b/python/paddle/fluid/tests/unittests/mkldnn/test_split_bf16_mkldnn_op.py @@ -15,8 +15,7 @@ import unittest import numpy as np import paddle -import paddle.fluid as fluid -from paddle.fluid import compiler, Program, program_guard, core +from paddle.fluid import core from paddle.fluid.tests.unittests.op_test import OpTest diff --git a/python/paddle/fluid/tests/unittests/mkldnn/test_split_mkldnn_op.py b/python/paddle/fluid/tests/unittests/mkldnn/test_split_mkldnn_op.py index 7de606c2122cefb15adeefcd77e6b8eec3e7c959..2b1e1fc9f226a1fcf3642b18aeb0cd0d3f2e275c 100644 --- a/python/paddle/fluid/tests/unittests/mkldnn/test_split_mkldnn_op.py +++ b/python/paddle/fluid/tests/unittests/mkldnn/test_split_mkldnn_op.py @@ -15,8 +15,6 @@ import unittest import numpy as np import paddle -import paddle.fluid as fluid -from paddle.fluid import compiler, Program, program_guard, core from paddle.fluid.tests.unittests.op_test import OpTest diff --git a/python/paddle/fluid/tests/unittests/mkldnn/test_stack_mkldnn_op.py b/python/paddle/fluid/tests/unittests/mkldnn/test_stack_mkldnn_op.py index 432ceafcfd06c27d62da9dfb9462bc433bd18598..5638c14b9e4880801a8b56d455fca55c3327fa52 100644 --- a/python/paddle/fluid/tests/unittests/mkldnn/test_stack_mkldnn_op.py +++ b/python/paddle/fluid/tests/unittests/mkldnn/test_stack_mkldnn_op.py @@ -14,9 +14,8 @@ import unittest import numpy as np -from paddle.fluid.tests.unittests.op_test import OpTest, OpTestTool, skip_check_grad_ci +from paddle.fluid.tests.unittests.op_test import OpTest, OpTestTool import paddle -import paddle.fluid as fluid import paddle.fluid.core as core diff --git a/python/paddle/fluid/tests/unittests/mkldnn/test_sum_bf16_mkldnn_op.py b/python/paddle/fluid/tests/unittests/mkldnn/test_sum_bf16_mkldnn_op.py index 4528ac04517d6e10ec72a1bbd7d9fa58035014a9..6792eaf7e6944bbdf48da08cdf29ff94d26f3ba0 100644 --- a/python/paddle/fluid/tests/unittests/mkldnn/test_sum_bf16_mkldnn_op.py +++ b/python/paddle/fluid/tests/unittests/mkldnn/test_sum_bf16_mkldnn_op.py @@ -15,10 +15,9 @@ import unittest import paddle.fluid.core as core from paddle.fluid.tests.unittests.test_sum_op import TestSumOp -from paddle.fluid.tests.unittests.op_test import OpTest, convert_float_to_uint16 +from paddle.fluid.tests.unittests.op_test import convert_float_to_uint16 from paddle import enable_static import numpy as np -import paddle.fluid.op as fluid_op @unittest.skipIf(not core.supports_bfloat16(), diff --git a/python/paddle/fluid/tests/unittests/test_cuda_random_seed.py b/python/paddle/fluid/tests/unittests/test_cuda_random_seed.py index 944fa777d90ca662dd8c83bf81e4f31ad18e48ab..f12d3a5a4d64d40a45ac3e5de2b7f25c67ab0e33 100644 --- a/python/paddle/fluid/tests/unittests/test_cuda_random_seed.py +++ b/python/paddle/fluid/tests/unittests/test_cuda_random_seed.py @@ -16,7 +16,6 @@ import os import unittest -import time # temp for debug import paddle.fluid as fluid import numpy as np import paddle diff --git a/python/paddle/fluid/tests/unittests/test_dataset.py b/python/paddle/fluid/tests/unittests/test_dataset.py index 13b6b9838ccdcbd83571fab1b71f819130a8194a..8e09e8f75c90c8a89498a289f3db1a6f647e4e5a 100644 --- a/python/paddle/fluid/tests/unittests/test_dataset.py +++ b/python/paddle/fluid/tests/unittests/test_dataset.py @@ -18,7 +18,6 @@ including create, config, run, etc. import paddle import paddle.fluid as fluid -import paddle.compat as cpt import paddle.fluid.core as core import os import tempfile diff --git a/python/paddle/fluid/tests/unittests/test_exception.py b/python/paddle/fluid/tests/unittests/test_exception.py index a3d9e744481b487d2f68625a074731b04b1fb908..6d39f9f5f41c516d3b46adc76fe076703993c81f 100644 --- a/python/paddle/fluid/tests/unittests/test_exception.py +++ b/python/paddle/fluid/tests/unittests/test_exception.py @@ -17,7 +17,6 @@ import unittest import paddle import paddle.fluid as fluid -import paddle.compat as cpt import paddle.fluid.core as core diff --git a/python/paddle/fluid/tests/unittests/test_fs_interface.py b/python/paddle/fluid/tests/unittests/test_fs_interface.py index 22e07f9030f2fd9a4df732152ca983efeebcb28b..e4682e5f731fe86cfb3ab12f276fe379c6b5d98a 100644 --- a/python/paddle/fluid/tests/unittests/test_fs_interface.py +++ b/python/paddle/fluid/tests/unittests/test_fs_interface.py @@ -13,7 +13,6 @@ # limitations under the License. import unittest -import sys import inspect from paddle.distributed.fleet.utils.fs import FS diff --git a/python/paddle/fluid/tests/unittests/test_generator.py b/python/paddle/fluid/tests/unittests/test_generator.py index 515581029ab74ccfb9bdc84d9bb3f3ad42655b99..445c7b050d02600b4faa7848d21074d0fdfd17c2 100644 --- a/python/paddle/fluid/tests/unittests/test_generator.py +++ b/python/paddle/fluid/tests/unittests/test_generator.py @@ -16,7 +16,6 @@ import unittest import paddle import paddle.fluid.generator as generator -import time # temp for debug class TestGenerator(unittest.TestCase): diff --git a/python/paddle/fluid/tests/unittests/test_imperative_data_loader_exception.py b/python/paddle/fluid/tests/unittests/test_imperative_data_loader_exception.py index a9fed3cae36c6dc3f9e04308158235878d8028f1..1389b93c38e7835c3604142b45a106aa588db9c9 100644 --- a/python/paddle/fluid/tests/unittests/test_imperative_data_loader_exception.py +++ b/python/paddle/fluid/tests/unittests/test_imperative_data_loader_exception.py @@ -17,7 +17,6 @@ import unittest import numpy as np import paddle.fluid as fluid from paddle.fluid import core -import paddle.compat as cpt from paddle.fluid.framework import _test_eager_guard diff --git a/python/paddle/fluid/tests/unittests/test_imperative_data_loader_exit_func.py b/python/paddle/fluid/tests/unittests/test_imperative_data_loader_exit_func.py index b1c2f7715b60bcbe3bc9724dc0de6b7f2456da1e..ec59d473c13df406e6c98338bc2386cf612aacdf 100644 --- a/python/paddle/fluid/tests/unittests/test_imperative_data_loader_exit_func.py +++ b/python/paddle/fluid/tests/unittests/test_imperative_data_loader_exit_func.py @@ -12,13 +12,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -import sys import signal import unittest import multiprocessing import time -import paddle.compat as cpt from paddle.fluid.framework import _test_eager_guard import queue diff --git a/python/paddle/fluid/tests/unittests/test_imperative_data_loader_process.py b/python/paddle/fluid/tests/unittests/test_imperative_data_loader_process.py index 9d4b69535411c1322e7e74be18af3e60998dc7fd..94322a67959597d616b6771e569783369c01b88a 100644 --- a/python/paddle/fluid/tests/unittests/test_imperative_data_loader_process.py +++ b/python/paddle/fluid/tests/unittests/test_imperative_data_loader_process.py @@ -12,7 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import sys import unittest import multiprocessing import numpy as np diff --git a/python/paddle/fluid/tests/unittests/test_imperative_double_grad.py b/python/paddle/fluid/tests/unittests/test_imperative_double_grad.py index 5fb80c80d9d12eb2ac671aea65b50f27af715ca3..1d77c5132399b9748689df9eab2d2a18fd9a096a 100644 --- a/python/paddle/fluid/tests/unittests/test_imperative_double_grad.py +++ b/python/paddle/fluid/tests/unittests/test_imperative_double_grad.py @@ -19,7 +19,6 @@ from paddle.vision.models import resnet50, resnet101 import unittest from unittest import TestCase import numpy as np -import paddle.compat as cpt from paddle.fluid.framework import _test_eager_guard diff --git a/python/paddle/fluid/tests/unittests/test_imperative_signal_handler.py b/python/paddle/fluid/tests/unittests/test_imperative_signal_handler.py index 72be7aafaf0d3229a2f21e5f5df2a9da8b4c6bc9..977cb9cc2576d6ca13d7ea2842447ff316950c12 100644 --- a/python/paddle/fluid/tests/unittests/test_imperative_signal_handler.py +++ b/python/paddle/fluid/tests/unittests/test_imperative_signal_handler.py @@ -19,7 +19,6 @@ import unittest import multiprocessing import time -import paddle.compat as cpt from paddle.fluid import core from paddle.fluid.framework import _test_eager_guard diff --git a/python/paddle/fluid/tests/unittests/test_lookup_table_op.py b/python/paddle/fluid/tests/unittests/test_lookup_table_op.py index ce79317866bc8d052d5bbfde98cbf5f2757b6c7c..2a57ca7e5968f637503d035d194e297e4698fcf7 100644 --- a/python/paddle/fluid/tests/unittests/test_lookup_table_op.py +++ b/python/paddle/fluid/tests/unittests/test_lookup_table_op.py @@ -17,7 +17,6 @@ import numpy as np from op_test import OpTest, skip_check_grad_ci, check_out_dtype import paddle.fluid.core as core from paddle.fluid.op import Operator -import paddle.compat as cpt import paddle.fluid as fluid from paddle.fluid import Program, program_guard import paddle.nn.functional as F diff --git a/python/paddle/fluid/tests/unittests/test_lookup_table_v2_op.py b/python/paddle/fluid/tests/unittests/test_lookup_table_v2_op.py index 3b0a093426053165b1be4cdb5402e78637767161..4919c9e8c00891d249ff85662f52225e8b3404d5 100644 --- a/python/paddle/fluid/tests/unittests/test_lookup_table_v2_op.py +++ b/python/paddle/fluid/tests/unittests/test_lookup_table_v2_op.py @@ -19,7 +19,6 @@ import paddle import paddle.fluid.core as core import paddle.fluid as fluid from paddle.fluid.op import Operator -import paddle.compat as cpt import paddle.fluid as fluid from paddle.fluid import Program, program_guard diff --git a/python/paddle/fluid/tests/unittests/test_operator_desc.py b/python/paddle/fluid/tests/unittests/test_operator_desc.py index 2b2c7287014a90e3507bfbd2f151eb323a6ab2d6..eeb7dfe95db6a6be5b8a31d0fa101c5f89633a1d 100644 --- a/python/paddle/fluid/tests/unittests/test_operator_desc.py +++ b/python/paddle/fluid/tests/unittests/test_operator_desc.py @@ -15,7 +15,6 @@ import unittest import paddle.fluid.core as core -import paddle.compat as cpt from paddle.fluid.framework import Program, default_startup_program diff --git a/python/paddle/fluid/tests/unittests/test_optimizer.py b/python/paddle/fluid/tests/unittests/test_optimizer.py index 52ce642c0e7de3f8b5f0a1101f44ea0d0b16a5fd..47d42e354cadbfab527ccc93b23b7e8745f5c8ab 100644 --- a/python/paddle/fluid/tests/unittests/test_optimizer.py +++ b/python/paddle/fluid/tests/unittests/test_optimizer.py @@ -20,7 +20,6 @@ import paddle.fluid as fluid import paddle.fluid.framework as framework import paddle.fluid.optimizer as optimizer import paddle.fluid.core as core -import paddle.compat as cpt import numpy as np from paddle.fluid.backward import append_backward from paddle.fluid.framework import Program, program_guard, convert_np_dtype_to_dtype_ diff --git a/python/paddle/fluid/tests/unittests/test_prune.py b/python/paddle/fluid/tests/unittests/test_prune.py index dc44f99d670b6f0c8ecd0cc0b277018bc936ca99..b6386e696746688c6551abe606664709c1168726 100644 --- a/python/paddle/fluid/tests/unittests/test_prune.py +++ b/python/paddle/fluid/tests/unittests/test_prune.py @@ -17,7 +17,6 @@ import unittest import paddle import paddle.fluid as fluid import paddle.fluid.framework as framework -import paddle.compat as cpt import numpy as np import os import contextlib diff --git a/python/paddle/fluid/tests/unittests/test_random_seed.py b/python/paddle/fluid/tests/unittests/test_random_seed.py index 8cb33ad53847e1fbd88424939f495f26af92f12e..c49808f3ae54df48a322db6970ec97cf7d7ba5ba 100644 --- a/python/paddle/fluid/tests/unittests/test_random_seed.py +++ b/python/paddle/fluid/tests/unittests/test_random_seed.py @@ -16,7 +16,6 @@ import unittest import paddle.fluid.generator as generator -import time # temp for debug import paddle.fluid as fluid import numpy as np import paddle diff --git a/python/paddle/fluid/tests/unittests/test_zeros_op.py b/python/paddle/fluid/tests/unittests/test_zeros_op.py index 3072a04f257d4b34726c8bf6f7ff6236a05e7fa0..d91230a48f258cc5df26f1a9d46aaea45f7cc4b9 100644 --- a/python/paddle/fluid/tests/unittests/test_zeros_op.py +++ b/python/paddle/fluid/tests/unittests/test_zeros_op.py @@ -15,7 +15,6 @@ import unittest import numpy as np import paddle -import paddle.compat as cpt import paddle.fluid as fluid from paddle.fluid import Program, program_guard from paddle.fluid.framework import _test_eager_guard