未验证 提交 2c407ef0 编写于 作者: N Nyakku Shigure 提交者: GitHub

[CodeStyle][F401] remove unused import in unittests/test_[k-o] (#46704)

上级 3b5064d6
......@@ -14,10 +14,9 @@
import numpy as np
import paddle
from paddle import fluid, nn
from paddle import fluid
import paddle.fluid.dygraph as dg
import paddle.nn.functional as F
import paddle.fluid.initializer as I
import unittest
......
......@@ -16,7 +16,6 @@ import unittest
import numpy as np
from op_test import OpTest
import paddle
import paddle.fluid as fluid
from paddle.fluid import core
from paddle.fluid.op import Operator
......
......@@ -14,9 +14,7 @@
import unittest
import numpy as np
from op_test import OpTest
from paddle.fluid import core
from paddle.fluid.op import Operator
from paddle.fluid.dygraph.base import switch_to_static_graph
import paddle
import paddle.fluid as fluid
......
......@@ -12,14 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import sys
import subprocess
import os
import time
import six
import copy
import unittest
import paddle.fluid as fluid
from argparse import ArgumentParser, REMAINDER
from paddle.distributed.utils.launch_utils import _print_arguments, get_gpus, get_cluster_from_args
......
......@@ -12,14 +12,11 @@
# 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.op import Operator
import paddle.fluid as fluid
from op_test import OpTest, _set_use_system_allocator
from paddle.fluid.framework import grad_var_name, _test_eager_guard
from paddle.fluid.framework import _test_eager_guard
import paddle.fluid as fluid
from paddle.fluid import Program, program_guard
import paddle
......
......@@ -17,7 +17,6 @@ import json
import tempfile
import unittest
import warnings
import numpy
import paddle
import paddle.nn.functional as F
......
......@@ -17,8 +17,6 @@ import numpy as np
import paddle
import paddle.fluid as fluid
import paddle.fluid.core as core
from paddle.fluid import Program, program_guard
from op_test import OpTest
paddle.enable_static()
......
......@@ -17,7 +17,6 @@ import math
import numpy as np
import unittest
import paddle
import paddle.fluid as fluid
import paddle.fluid.layers as layers
import paddle.fluid.framework as framework
......
......@@ -16,11 +16,7 @@ import unittest
import numpy as np
import paddle
import paddle.fluid as fluid
import paddle.fluid.layers as layers
import paddle.fluid.core as core
from op_test import OpTest, skip_check_grad_ci
from gradient_checker import grad_check
from decorator_helper import prog_scope
class LinalgPinvTestCase(unittest.TestCase):
......
......@@ -15,12 +15,9 @@
import unittest
import numpy as np
import paddle.fluid.core as core
from op_test import OpTest
import paddle
from paddle import fluid, nn
import paddle.fluid.dygraph as dg
from paddle import fluid
import paddle.nn.functional as F
import paddle.fluid.initializer as I
class LinearTestCase(unittest.TestCase):
......
......@@ -17,7 +17,7 @@ import numpy as np
from op_test import OpTest
import paddle
import paddle.fluid as fluid
from paddle.fluid import compiler, Program, program_guard
from paddle.fluid import Program, program_guard
from paddle.fluid import core
from paddle.fluid.framework import _test_eager_guard
......
......@@ -19,12 +19,9 @@ silentremove("test_list_and_serv_run_empty_optimize_block.flag")
import paddle
import paddle.fluid as fluid
import signal
import subprocess
import time
import unittest
from multiprocessing import Process
from op_test import OpTest
paddle.enable_static()
......
......@@ -14,7 +14,6 @@
import unittest
import numpy as np
from op_test import OpTest, randomize_probability
import paddle.fluid as fluid
import paddle.fluid.layers as layers
import os
......
......@@ -16,7 +16,6 @@ import unittest
import numpy as np
import os
import tempfile
from op_test import OpTest, randomize_probability
import paddle.fluid as fluid
import paddle.fluid.layers as layers
import paddle
......
......@@ -15,8 +15,6 @@
import unittest
import os
import shutil
import numpy as np
import paddle as paddle
import paddle.fluid as fluid
from paddle.fluid.executor import Executor
......
......@@ -15,11 +15,7 @@
import unittest
import numpy as np
import paddle.fluid as fluid
import paddle.fluid.layers as layers
import paddle.fluid.core as core
from paddle.fluid import compiler, Program, program_guard
from paddle.fluid.op import Operator
from paddle.fluid.backward import append_backward
from paddle.fluid import Program
class TestLoDAppendAPI(unittest.TestCase):
......
......@@ -19,7 +19,7 @@ import paddle.fluid.layers as layers
from paddle.fluid.executor import Executor
import paddle.fluid.core as core
import paddle.fluid as fluid
from paddle.fluid import compiler, Program, program_guard
from paddle.fluid import Program, program_guard
import numpy
......
......@@ -19,8 +19,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.framework import _test_eager_guard
from op_test import OpTest
......
......@@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import op_test
import unittest
import numpy as np
import paddle
......
......@@ -14,13 +14,10 @@
import unittest
import numpy as np
from op_test import OpTest
from paddle.fluid import core
from paddle.fluid.op import Operator
import paddle.fluid as fluid
import paddle
import paddle.nn as nn
from paddle.fluid.framework import _test_eager_guard, _in_legacy_dygraph
from paddle.fluid.framework import _test_eager_guard
LOOKAHEAD_K = 5
LOOKAHEAD_ALPHA = 0.2
......
......@@ -14,12 +14,7 @@
import unittest
import numpy as np
from op_test import OpTest, skip_check_grad_ci
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
from op_test import OpTest
import struct
......
......@@ -15,8 +15,7 @@
import unittest
import numpy as np
import paddle
from paddle.fluid.tests.unittests.op_test import (skip_check_grad_ci,
convert_uint16_to_float)
from paddle.fluid.tests.unittests.op_test import convert_uint16_to_float
from paddle.fluid.tests.unittests.test_lookup_table_bf16_op import (
_lookup, TestLookupTableBF16Op, TestLookupTableBF16OpIds4D,
TestLookupTableBF16OpWIsSelectedRows,
......
......@@ -12,15 +12,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import copy
import math
import numpy as np
import unittest
import paddle
import paddle.fluid as fluid
import paddle.fluid.layers as layers
import paddle.fluid.framework as framework
import paddle.fluid.core as core
......
......@@ -18,7 +18,7 @@ import numpy as np
import paddle.fluid as fluid
import paddle.fluid.core as core
from op_test import OpTest
from paddle.fluid import compiler, Program, program_guard
from paddle.fluid import Program, program_guard
class TestLRNOp(OpTest):
......
......@@ -14,7 +14,7 @@
import unittest
import numpy as np
from op_test import OpTest, skip_check_grad_ci
from op_test import OpTest
from paddle import fluid
from paddle.fluid.layers import lstm as LSTM
from paddle.fluid.layers import fill_constant
......
......@@ -18,7 +18,6 @@ import itertools
import numpy as np
import paddle
import paddle.fluid as fluid
import paddle.fluid.layers as layers
import paddle.fluid.core as core
import scipy
import scipy.linalg
......
......@@ -18,7 +18,6 @@ import itertools
import numpy as np
import paddle
import paddle.fluid as fluid
import paddle.fluid.layers as layers
import paddle.fluid.core as core
import scipy
import scipy.linalg
......
......@@ -16,8 +16,6 @@ import unittest
import paddle
import paddle.fluid as fluid
from paddle.framework import seed
from paddle.fluid.framework import Program, default_main_program, default_startup_program
import numpy as np
......
......@@ -15,10 +15,7 @@
import unittest
import numpy as np
from op_test import OpTest
import math
import random
import paddle
import paddle.fluid as fluid
from paddle.fluid import core
from paddle.fluid import Program, program_guard
......
......@@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import unittest
import numpy as np
from op_test import OpTest
from paddle.distributed.fleet.meta_optimizers.common import OpRole
......
......@@ -15,7 +15,6 @@
import unittest
import numpy as np
from op_test import OpTest
import paddle.fluid as fluid
import paddle
......
......@@ -17,7 +17,7 @@ import paddle
import paddle.fluid as fluid
import numpy as np
import inspect
from paddle.fluid.framework import _test_eager_guard, _in_legacy_dygraph
from paddle.fluid.framework import _test_eager_guard
class TestMathOpPatchesVarBase(unittest.TestCase):
......
......@@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import paddle.fluid.core as core
import unittest
import numpy as np
from op_test import OpTest
......
......@@ -20,7 +20,6 @@ import paddle.fluid.core as core
import paddle
import paddle.fluid as fluid
import paddle.fluid.framework as framework
from paddle.fluid.framework import _test_eager_guard
......
......@@ -359,10 +359,8 @@ class TestMatrixPowerSingularAPI(unittest.TestCase):
fetch_list=[result])
except RuntimeError as ex:
print("The mat is singular")
pass
except ValueError as ex:
print("The mat is singular")
pass
def test_static(self):
paddle.enable_static()
......@@ -379,10 +377,8 @@ class TestMatrixPowerSingularAPI(unittest.TestCase):
result = paddle.linalg.matrix_power(input, -2)
except RuntimeError as ex:
print("The mat is singular")
pass
except ValueError as ex:
print("The mat is singular")
pass
if __name__ == "__main__":
......
......@@ -16,13 +16,10 @@ import unittest
import numpy as np
from paddle.fluid.tests.unittests.op_test import OpTest, convert_float_to_uint16
from paddle.fluid.tests.unittests.op_test import OpTest
import paddle
import paddle.nn as nn
import paddle.nn.functional as F
import paddle.fluid as fluid
import paddle.fluid.core as core
from paddle.fluid import compiler, Program, program_guard
paddle.enable_static()
SEED = 2049
......
......@@ -17,8 +17,6 @@ import numpy as np
import paddle
import paddle.fluid as fluid
import paddle.fluid.core as core
from paddle.fluid import Program, program_guard
from op_test import OpTest
paddle.enable_static()
......
......@@ -12,15 +12,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import os
import unittest
import tempfile
import numpy as np
from op_test import OpTest, skip_check_grad_ci, check_out_dtype
from op_test import check_out_dtype
import paddle
from paddle.fluid.framework import _test_eager_guard
import paddle.fluid.core as core
import paddle.inference as paddle_infer
from test_sum_op import TestReduceOPTensorAxisBase
......
......@@ -16,7 +16,6 @@ import unittest
import numpy as np
from op_test import OpTest
import paddle.fluid as fluid
import paddle
def compute_mean_iou(predictions, labels, num_classes, in_wrongs, in_corrects,
......
......@@ -19,7 +19,6 @@ import paddle
import paddle.fluid.core as core
import paddle.fluid as fluid
from paddle.fluid import Program, program_guard
from paddle.fluid.framework import _test_eager_guard
from test_sum_op import TestReduceOPTensorAxisBase
import gradient_checker
from decorator_helper import prog_scope
......
......@@ -12,15 +12,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import op_test
import numpy as np
import unittest
import paddle
import paddle.fluid.core as core
from paddle.fluid.op import Operator
import paddle.fluid as fluid
from paddle.fluid import compiler, Program, program_guard
from paddle.fluid.backward import append_backward
from paddle.fluid import Program, program_guard
class TestMemcpy_FillConstant(unittest.TestCase):
......
......@@ -14,10 +14,9 @@
import unittest
import numpy as np
from op_test import OpTest, skip_check_grad_ci
from op_test import OpTest
import paddle.fluid as fluid
import paddle
from paddle.fluid import compiler, Program, program_guard, core
from paddle.fluid.framework import _test_eager_guard
......
......@@ -12,15 +12,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import os
import unittest
import tempfile
import numpy as np
from op_test import OpTest, skip_check_grad_ci, check_out_dtype
from op_test import check_out_dtype
import paddle
import paddle.fluid.core as core
from paddle.fluid.framework import _test_eager_guard
import paddle.inference as paddle_infer
from test_sum_op import TestReduceOPTensorAxisBase
......
......@@ -14,8 +14,6 @@
import unittest
import numpy as np
import sys
import math
from op_test import OpTest
......
......@@ -13,9 +13,6 @@
# limitations under the License.
import paddle.fluid.core as core
import math
import os
import sys
import unittest
import numpy as np
......
......@@ -14,9 +14,6 @@
import unittest
import numpy as np
from op_test import OpTest
from paddle.fluid import core
from paddle.fluid.op import Operator
import paddle.fluid as fluid
import paddle
import paddle.nn as nn
......
......@@ -21,7 +21,6 @@ paddle.enable_static()
import paddle.fluid as fluid
import paddle.fluid.core as core
import numpy as np
import os
import unittest
import tempfile
......
......@@ -14,7 +14,6 @@
import unittest
import numpy as np
import paddle
import paddle.fluid.core as core
import sys
......
......@@ -14,7 +14,7 @@
import unittest
import numpy as np
from op_test import OpTest, skip_check_grad_ci
from op_test import OpTest
from numpy.linalg import multi_dot
from op_test import OpTest
import paddle
......
......@@ -15,7 +15,6 @@
import unittest
import paddle
import paddle.fluid as fluid
from paddle.fluid import core
from op_test import OpTest
import numpy as np
import os
......
......@@ -19,7 +19,7 @@ import numpy as np
import paddle
import paddle.tensor as tensor
from paddle.static import Program, program_guard
from paddle.fluid.framework import _test_eager_guard, in_dygraph_mode
from paddle.fluid.framework import _test_eager_guard
class TestMultiplyApi(unittest.TestCase):
......
......@@ -18,8 +18,8 @@ import numpy as np
import paddle
import paddle.fluid as fluid
from paddle.io import Dataset, IterableDataset, TensorDataset, \
ComposeDataset, ChainDataset, DataLoader, random_split, Subset
from paddle.fluid.framework import _test_eager_guard, _in_legacy_dygraph
ComposeDataset, ChainDataset, DataLoader
from paddle.fluid.framework import _test_eager_guard
IMAGE_SIZE = 32
......
......@@ -12,18 +12,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import os
import sys
import six
import time
import unittest
import multiprocessing
import numpy as np
import paddle.fluid as fluid
from paddle.io import Dataset, BatchSampler, DataLoader
from paddle.io import DataLoader
from paddle.fluid.dygraph.nn import Linear
from paddle.fluid.dygraph.base import to_variable
from test_multiprocess_dataloader_static import RandomDataset, RandomBatchedDataset, prepare_places
from test_multiprocess_dataloader_static import EPOCH_NUM, BATCH_SIZE, IMAGE_SIZE, SAMPLE_NUM, CLASS_NUM
......
......@@ -12,10 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import os
import sys
import six
import time
import unittest
import multiprocessing
import numpy as np
......@@ -23,8 +19,6 @@ import numpy as np
import paddle.fluid as fluid
import paddle.fluid.core as core
from paddle.io import Dataset, IterableDataset, BatchSampler, DataLoader
from paddle.fluid.dygraph.nn import Linear
from paddle.fluid.dygraph.base import to_variable
from paddle.fluid.dataloader.dataloader_iter import _worker_loop
......
......@@ -12,18 +12,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import os
import sys
import six
import time
import unittest
import multiprocessing
import numpy as np
import paddle.fluid as fluid
from paddle.io import Dataset, BatchSampler, DataLoader
from paddle.io import DataLoader
from paddle.fluid.dygraph.nn import Linear
from paddle.fluid.dygraph.base import to_variable
from test_multiprocess_dataloader_iterable_dataset_static import RandomDataset, RandomBatchedDataset, prepare_places
from test_multiprocess_dataloader_iterable_dataset_static import EPOCH_NUM, BATCH_SIZE, IMAGE_SIZE, SAMPLE_NUM, CLASS_NUM
......
......@@ -17,7 +17,7 @@ import unittest
import numpy as np
import paddle.fluid as fluid
from paddle.io import IterableDataset, BatchSampler, DataLoader, get_worker_info
from paddle.io import DataLoader, IterableDataset, get_worker_info
class RangeIterableDatasetSplit(IterableDataset):
......
......@@ -12,16 +12,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import os
import sys
import six
import time
import unittest
import multiprocessing
import numpy as np
import paddle.fluid as fluid
from paddle.io import IterableDataset, BatchSampler, DataLoader, get_worker_info
from paddle.io import DataLoader, IterableDataset
EPOCH_NUM = 2
BATCH_SIZE = 8
......
......@@ -12,17 +12,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import os
import sys
import six
import time
import unittest
import multiprocessing
import numpy as np
import paddle
import paddle.fluid as fluid
from paddle.io import Dataset, BatchSampler, DataLoader
from paddle.io import DataLoader, Dataset
EPOCH_NUM = 3
BATCH_SIZE = 8
......
......@@ -17,8 +17,6 @@ import paddle.fluid as fluid
from paddle.reader import multiprocess_reader
import unittest
import numpy as np
import six
import sys
class ReaderException(Exception):
......
......@@ -15,9 +15,6 @@
import unittest
import numpy as np
import paddle
import paddle.fluid as fluid
import paddle.fluid.layers as layers
import paddle.fluid.core as core
from paddle.static import program_guard, Program
from op_test import OpTest
......
......@@ -15,9 +15,7 @@
import unittest
import numpy as np
import paddle
import paddle.fluid as fluid
import paddle.fluid.core as core
from paddle.fluid import Program, program_guard
np.random.seed(10)
......
......@@ -16,8 +16,6 @@ import unittest
import numpy as np
import paddle
import paddle.fluid as fluid
import paddle.fluid.core as core
from paddle.fluid import Program, program_guard
class API_Test_Nansum(unittest.TestCase):
......
......@@ -17,7 +17,6 @@ import numpy as np
from op_test import OpTest
import paddle.fluid.core as core
import paddle.fluid as fluid
import paddle.nn as nn
import paddle
from paddle.nn.functional import interpolate
......
......@@ -14,11 +14,9 @@
import unittest
import numpy as np
import paddle
import paddle.fluid as fluid
import paddle.fluid.core as core
from paddle.fluid.executor import Executor
BATCH_SIZE = 20
......
......@@ -15,7 +15,6 @@
import unittest
import paddle
import paddle.nn as nn
import numpy as np
from paddle.fluid.framework import _test_eager_guard
......
......@@ -14,13 +14,11 @@
import unittest
import numpy as np
import math
from op_test import OpTest
import paddle
import paddle.fluid as fluid
import paddle.fluid.core as core
import paddle.nn.functional as functional
import paddle.fluid.framework as framework
from paddle.fluid.framework import Program, program_guard
......
......@@ -17,7 +17,6 @@ import numpy as np
import paddle
import paddle.fluid as fluid
import paddle.fluid.layers as layers
import paddle.fluid.core as core
import gradient_checker
from decorator_helper import prog_scope
......
......@@ -16,8 +16,6 @@ import unittest
import numpy as np
import paddle
import paddle.fluid.core as core
from op_test import OpTest
from scipy.special import expit, erf
import paddle
import paddle.fluid as fluid
import paddle.nn as nn
......
......@@ -14,7 +14,6 @@
import unittest
import numpy as np
from op_test import OpTest
import paddle
import paddle.fluid as fluid
from paddle.fluid import Program, program_guard
......
......@@ -16,7 +16,6 @@ import unittest
import paddle
import paddle.nn.functional as F
import paddle.fluid as fluid
import paddle.fluid.core as core
import numpy as np
from paddle.fluid.framework import _test_eager_guard
......
......@@ -17,10 +17,6 @@ import numpy as np
import unittest
import paddle
import paddle.fluid.core as core
from paddle.fluid.op import Operator
import paddle.fluid as fluid
from paddle.fluid import compiler, Program, program_guard
from paddle.fluid.backward import append_backward
from paddle.distributed.models.moe import utils
from paddle.fluid.framework import _test_eager_guard
......
......@@ -15,10 +15,7 @@
import unittest
import numpy as np
from op_test import OpTest
import paddle.fluid.core as core
import paddle.fluid as fluid
from paddle.fluid import Program, program_guard
import functools
import paddle
......
......@@ -14,12 +14,10 @@
import unittest
import numpy as np
import math
from op_test import OpTest
import paddle
import paddle.fluid as fluid
import paddle.fluid.core as core
import paddle.fluid.framework as framework
from paddle.fluid.framework import Program, program_guard
......
......@@ -14,12 +14,10 @@
import unittest
import numpy as np
import math
from op_test import OpTest
import paddle
import paddle.fluid as fluid
import paddle.fluid.core as core
import paddle.fluid.framework as framework
from paddle.fluid.framework import Program, program_guard, _test_eager_guard
......
......@@ -16,7 +16,7 @@ import unittest
import numpy as np
import paddle
import paddle.fluid as fluid
from paddle import _C_ops, _legacy_C_ops
from paddle import _C_ops
from paddle import ones_like
from paddle.fluid import core, Program, program_guard
from paddle.fluid.framework import convert_np_dtype_to_dtype_
......
......@@ -14,11 +14,8 @@
import unittest
import numpy as np
from op_test import OpTest
import paddle
import paddle.fluid.core as core
from paddle.fluid.op import Operator
import paddle.fluid as fluid
import numpy as np
......
......@@ -12,14 +12,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import os
import pickle
import unittest
import numpy as np
import paddle
from paddle.static import InputSpec
from paddle.fluid.framework import in_dygraph_mode, _test_eager_guard
from paddle.fluid.framework import _test_eager_guard
class LinearNet(paddle.nn.Layer):
......
......@@ -13,13 +13,12 @@
# limitations under the License.
import unittest
from paddle.fluid.framework import default_main_program, Program, convert_np_dtype_to_dtype_, _non_static_mode, in_dygraph_mode
from paddle.fluid.framework import in_dygraph_mode
import paddle.fluid as fluid
import paddle.fluid.layers as layers
import paddle.fluid.core as core
from paddle.fluid.dygraph.jit import TracedLayer
import numpy as np
from paddle import _C_ops, _legacy_C_ops
from paddle import _legacy_C_ops
class TestTracedLayer(fluid.dygraph.Layer):
......
......@@ -18,7 +18,7 @@ import numpy as np
import paddle
from paddle.static import Program, program_guard
from paddle.fluid.framework import _test_eager_guard, in_dygraph_mode
from paddle.fluid.framework import _test_eager_guard
class TestMultiplyApi(unittest.TestCase):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册