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

[CodeStyle][isort] introduce isort (part2) (#48390)

* isort all files

* revert conflicting files

* revert conflicting files

* revert conflicting files

* revert conflicting files

* revert conflicting files
上级 f85def97
...@@ -13,8 +13,10 @@ ...@@ -13,8 +13,10 @@
# limitations under the License. # limitations under the License.
import unittest import unittest
import numpy as np import numpy as np
from op_test import OpTest from op_test import OpTest
import paddle import paddle
import paddle.fluid as fluid import paddle.fluid as fluid
from paddle.fluid import Program, program_guard from paddle.fluid import Program, program_guard
......
...@@ -13,17 +13,17 @@ ...@@ -13,17 +13,17 @@
# limitations under the License. # limitations under the License.
import unittest import unittest
import gradient_checker
import numpy as np import numpy as np
from decorator_helper import prog_scope
import paddle.fluid as fluid
import paddle import paddle
import paddle.fluid.layers as layers import paddle.fluid as fluid
import paddle.fluid.core as core import paddle.fluid.core as core
import gradient_checker import paddle.fluid.layers as layers
import paddle.nn.functional as F import paddle.nn.functional as F
from decorator_helper import prog_scope
class TestSigmoidTripleGradCheck(unittest.TestCase): class TestSigmoidTripleGradCheck(unittest.TestCase):
@prog_scope() @prog_scope()
......
...@@ -15,13 +15,13 @@ ...@@ -15,13 +15,13 @@
import unittest import unittest
import numpy as np import numpy as np
from scipy.special import expit, erf
from op_test import OpTest, convert_float_to_uint16 from op_test import OpTest, convert_float_to_uint16
from scipy.special import erf, expit
import paddle import paddle
import paddle.nn.functional as F
import paddle.fluid as fluid import paddle.fluid as fluid
import paddle.fluid.core as core import paddle.fluid.core as core
import paddle.nn.functional as F
from paddle.fluid import Program, program_guard from paddle.fluid import Program, program_guard
from paddle.fluid.framework import _test_eager_guard from paddle.fluid.framework import _test_eager_guard
......
...@@ -13,10 +13,12 @@ ...@@ -13,10 +13,12 @@
# limitations under the License. # limitations under the License.
import unittest import unittest
import numpy as np import numpy as np
import paddle
import paddle.fluid.core as core import paddle.fluid.core as core
from paddle.fluid.op import Operator from paddle.fluid.op import Operator
import paddle
class TestSparseSquareOp(unittest.TestCase): class TestSparseSquareOp(unittest.TestCase):
......
...@@ -13,8 +13,10 @@ ...@@ -13,8 +13,10 @@
# limitations under the License. # limitations under the License.
import unittest import unittest
import numpy as np import numpy as np
from op_test import OpTest from op_test import OpTest
import paddle import paddle
import paddle.fluid as fluid import paddle.fluid as fluid
......
...@@ -12,13 +12,15 @@ ...@@ -12,13 +12,15 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import math
import unittest import unittest
import numpy as np import numpy as np
import paddle.fluid.core as core
from paddle.fluid.op import Operator
from op_test import OpTest from op_test import OpTest
import math
import paddle import paddle
import paddle.fluid.core as core
from paddle.fluid.op import Operator
class TestAdagradOp1(OpTest): class TestAdagradOp1(OpTest):
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
# limitations under the License. # limitations under the License.
import unittest import unittest
import paddle import paddle
......
...@@ -13,13 +13,15 @@ ...@@ -13,13 +13,15 @@
# limitations under the License. # limitations under the License.
import unittest import unittest
import numpy as np import numpy as np
from op_test import OpTest 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
import paddle.fluid as fluid
from paddle.fluid import core
from paddle.fluid.framework import _test_eager_guard from paddle.fluid.framework import _test_eager_guard
from paddle.fluid.op import Operator
class TestAdamOp1(OpTest): class TestAdamOp1(OpTest):
......
...@@ -12,9 +12,10 @@ ...@@ -12,9 +12,10 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import unittest
import paddle import paddle
import paddle.fluid as fluid import paddle.fluid as fluid
import unittest
def get_places(): def get_places():
......
...@@ -13,7 +13,9 @@ ...@@ -13,7 +13,9 @@
# limitations under the License. # limitations under the License.
import unittest import unittest
import numpy as np import numpy as np
import paddle import paddle
import paddle.fluid as fluid import paddle.fluid as fluid
from paddle.fluid.framework import _test_eager_guard from paddle.fluid.framework import _test_eager_guard
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
# limitations under the License. # limitations under the License.
import unittest import unittest
import numpy as np import numpy as np
from op_test import OpTest from op_test import OpTest
......
...@@ -12,15 +12,17 @@ ...@@ -12,15 +12,17 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import unittest
import paddle
import random import random
import unittest
from functools import partial
import numpy as np import numpy as np
import paddle.fluid as fluid
from op_test import OpTest from op_test import OpTest
from functools import partial
from paddle.framework import core import paddle
import paddle.fluid as fluid
from paddle.fluid.framework import _test_eager_guard from paddle.fluid.framework import _test_eager_guard
from paddle.framework import core
def adamw_step(inputs, attributes): def adamw_step(inputs, attributes):
......
...@@ -12,14 +12,14 @@ ...@@ -12,14 +12,14 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import numpy as np
import unittest import unittest
import numpy as np import numpy as np
import paddle.fluid.core as core
import paddle.fluid as fluid
import paddle import paddle
import paddle.nn.functional as F
import paddle.fluid as fluid import paddle.fluid as fluid
import paddle.fluid.core as core
import paddle.nn.functional as F
def adaptive_start_index(index, input_size, output_size): def adaptive_start_index(index, input_size, output_size):
......
...@@ -14,15 +14,15 @@ ...@@ -14,15 +14,15 @@
import os import os
import unittest import unittest
import numpy as np import numpy as np
from test_attribute_var import UnittestBase
import paddle.fluid.core as core
import paddle import paddle
import paddle.fluid as fluid import paddle.fluid as fluid
import paddle.fluid.core as core
from paddle.fluid import Program, program_guard from paddle.fluid import Program, program_guard
from test_attribute_var import UnittestBase
def adaptive_start_index(index, input_size, output_size): def adaptive_start_index(index, input_size, output_size):
return int(np.floor(index * input_size / output_size)) return int(np.floor(index * input_size / output_size))
......
...@@ -13,11 +13,12 @@ ...@@ -13,11 +13,12 @@
# limitations under the License. # limitations under the License.
import unittest import unittest
import numpy as np import numpy as np
import paddle.fluid.core as core
import paddle import paddle
import paddle.fluid as fluid import paddle.fluid as fluid
import paddle.fluid.core as core
def adaptive_start_index(index, input_size, output_size): def adaptive_start_index(index, input_size, output_size):
......
...@@ -12,13 +12,15 @@ ...@@ -12,13 +12,15 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import numpy as np
import unittest import unittest
import numpy as np
from op_test import check_out_dtype from op_test import check_out_dtype
import paddle.fluid.core as core
import paddle import paddle
import paddle.nn.functional as F
import paddle.fluid as fluid import paddle.fluid as fluid
import paddle.fluid.core as core
import paddle.nn.functional as F
def adaptive_start_index(index, input_size, output_size): def adaptive_start_index(index, input_size, output_size):
......
...@@ -13,12 +13,13 @@ ...@@ -13,12 +13,13 @@
# limitations under the License. # limitations under the License.
import unittest import unittest
import numpy as np
import paddle.fluid.core as core import numpy as np
from op_test import check_out_dtype from op_test import check_out_dtype
import paddle import paddle
import paddle.fluid as fluid import paddle.fluid as fluid
import paddle.fluid.core as core
import paddle.nn.functional as F import paddle.nn.functional as F
......
...@@ -13,12 +13,13 @@ ...@@ -13,12 +13,13 @@
# limitations under the License. # limitations under the License.
import unittest import unittest
import numpy as np
import paddle.fluid.core as core import numpy as np
from op_test import check_out_dtype from op_test import check_out_dtype
import paddle import paddle
import paddle.fluid as fluid import paddle.fluid as fluid
import paddle.fluid.core as core
import paddle.nn.functional as F import paddle.nn.functional as F
......
...@@ -12,11 +12,13 @@ ...@@ -12,11 +12,13 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import paddle.fluid as fluid import time
from paddle.fluid.layer_helper import LayerHelper
import unittest import unittest
import numpy as np import numpy as np
import time
import paddle.fluid as fluid
from paddle.fluid.layer_helper import LayerHelper
def inplace_add(x, bias): def inplace_add(x, bias):
......
...@@ -13,9 +13,11 @@ ...@@ -13,9 +13,11 @@
# limitations under the License. # limitations under the License.
import unittest import unittest
import numpy as np import numpy as np
import paddle
from op_test import OpTest from op_test import OpTest
import paddle
import paddle.fluid as fluid import paddle.fluid as fluid
from paddle.fluid import Program, program_guard from paddle.fluid import Program, program_guard
......
...@@ -12,12 +12,14 @@ ...@@ -12,12 +12,14 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import paddle import unittest
import numpy as np import numpy as np
from paddle import fluid
import paddle
import paddle.fluid.dygraph as dg import paddle.fluid.dygraph as dg
import paddle.nn.functional as F import paddle.nn.functional as F
import unittest from paddle import fluid
class AffineGridTestCase(unittest.TestCase): class AffineGridTestCase(unittest.TestCase):
......
...@@ -13,8 +13,10 @@ ...@@ -13,8 +13,10 @@
# limitations under the License. # limitations under the License.
import unittest import unittest
import numpy as np import numpy as np
from op_test import OpTest from op_test import OpTest
import paddle import paddle
......
...@@ -12,10 +12,12 @@ ...@@ -12,10 +12,12 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import paddle
import paddle.fluid as fluid
import unittest import unittest
import numpy as np import numpy as np
import paddle
import paddle.fluid as fluid
from paddle.fluid.framework import _test_eager_guard from paddle.fluid.framework import _test_eager_guard
......
...@@ -13,8 +13,10 @@ ...@@ -13,8 +13,10 @@
# limitations under the License. # limitations under the License.
import unittest import unittest
import numpy as np import numpy as np
from op_test import OpTest from op_test import OpTest
import paddle import paddle
......
...@@ -13,10 +13,11 @@ ...@@ -13,10 +13,11 @@
# limitations under the License. # limitations under the License.
import unittest import unittest
import paddle
from test_collective_base import TestDistBase from test_collective_base import TestDistBase
import paddle
paddle.enable_static() paddle.enable_static()
......
...@@ -13,8 +13,10 @@ ...@@ -13,8 +13,10 @@
# limitations under the License. # limitations under the License.
import unittest import unittest
import numpy as np import numpy as np
from op_test import OpTest from op_test import OpTest
import paddle.fluid.contrib.mixed_precision.amp_nn as amp_nn import paddle.fluid.contrib.mixed_precision.amp_nn as amp_nn
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
# limitations under the License. # limitations under the License.
import unittest import unittest
import numpy as np import numpy as np
from op_test import OpTest from op_test import OpTest
......
...@@ -13,12 +13,13 @@ ...@@ -13,12 +13,13 @@
# limitations under the License. # limitations under the License.
import unittest import unittest
import numpy as np import numpy as np
from op_test import OpTest from op_test import OpTest
import paddle import paddle
from paddle.fluid import dygraph
from paddle import static from paddle import static
from paddle.fluid import dygraph
paddle.enable_static() paddle.enable_static()
......
...@@ -12,14 +12,16 @@ ...@@ -12,14 +12,16 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import unittest
import numpy as np
import paddle import paddle
from paddle.vision.models import resnet50 import paddle.fluid as fluid
from paddle.nn import CrossEntropyLoss
from paddle.fluid.framework import _apply_pass from paddle.fluid.framework import _apply_pass
from paddle.fluid.ir import apply_build_strategy from paddle.fluid.ir import apply_build_strategy
import paddle.fluid as fluid from paddle.nn import CrossEntropyLoss
import unittest from paddle.vision.models import resnet50
import numpy as np
def get_resnet50_model(): def get_resnet50_model():
......
...@@ -12,13 +12,15 @@ ...@@ -12,13 +12,15 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import paddle
from paddle.fluid import core
from paddle.static import program_guard, Program
import unittest import unittest
import numpy as np import numpy as np
from op_test import OpTest from op_test import OpTest
import paddle
from paddle.fluid import core
from paddle.static import Program, program_guard
class TestArangeOp(OpTest): class TestArangeOp(OpTest):
def setUp(self): def setUp(self):
......
...@@ -14,12 +14,14 @@ ...@@ -14,12 +14,14 @@
import os import os
import unittest import unittest
import numpy as np import numpy as np
from op_test import OpTest from op_test import OpTest
from test_attribute_var import UnittestBase
import paddle import paddle
import paddle.fluid.core as core import paddle.fluid.core as core
from paddle.fluid import Program, program_guard from paddle.fluid import Program, program_guard
from test_attribute_var import UnittestBase
class BaseTestCase(OpTest): class BaseTestCase(OpTest):
......
...@@ -13,8 +13,10 @@ ...@@ -13,8 +13,10 @@
# limitations under the License. # limitations under the License.
import unittest import unittest
import numpy as np import numpy as np
from op_test import OpTest from op_test import OpTest
import paddle import paddle
import paddle.fluid as fluid import paddle.fluid as fluid
import paddle.fluid.core as core import paddle.fluid.core as core
......
...@@ -13,14 +13,15 @@ ...@@ -13,14 +13,15 @@
# limitations under the License. # limitations under the License.
import unittest import unittest
import numpy as np
import paddle import paddle
import paddle.fluid as fluid import paddle.fluid as fluid
import numpy as np
import paddle.fluid.core as core import paddle.fluid.core as core
from paddle.fluid.framework import Program, grad_var_name
from paddle.fluid.executor import Executor
from paddle.fluid.backward import append_backward from paddle.fluid.backward import append_backward
from paddle.fluid.executor import Executor
from paddle.fluid.framework import Program, grad_var_name
np.random.seed(123) np.random.seed(123)
......
...@@ -14,15 +14,16 @@ ...@@ -14,15 +14,16 @@
import unittest import unittest
import numpy as np
import paddle import paddle
import paddle.fluid as fluid import paddle.fluid as fluid
import paddle.fluid.core as core import paddle.fluid.core as core
import paddle.fluid.layers as layers import paddle.fluid.layers as layers
from paddle.fluid.executor import Executor from paddle.fluid import Program, program_guard
from paddle.fluid.backward import append_backward from paddle.fluid.backward import append_backward
from paddle.fluid.executor import Executor
from paddle.fluid.framework import default_main_program from paddle.fluid.framework import default_main_program
from paddle.fluid import Program, program_guard
import numpy as np
def _test_read_write(x): def _test_read_write(x):
......
...@@ -12,9 +12,10 @@ ...@@ -12,9 +12,10 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import unittest
import paddle import paddle
import paddle.fluid as fluid import paddle.fluid as fluid
import unittest
class TestAscendTriggerOP(unittest.TestCase): class TestAscendTriggerOP(unittest.TestCase):
......
...@@ -12,10 +12,11 @@ ...@@ -12,10 +12,11 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import unittest
import paddle import paddle
import paddle.fluid as fluid import paddle.fluid as fluid
import paddle.fluid.layers as layers import paddle.fluid.layers as layers
import unittest
class TestAssertOp(unittest.TestCase): class TestAssertOp(unittest.TestCase):
......
...@@ -12,18 +12,20 @@ ...@@ -12,18 +12,20 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import op_test
import numpy as np
import unittest import unittest
import gradient_checker
import numpy as np
import op_test
from decorator_helper import prog_scope
import paddle import paddle
import paddle.fluid.core as core
import paddle.fluid as fluid import paddle.fluid as fluid
from paddle.fluid import Program, program_guard import paddle.fluid.core as core
from paddle.fluid.backward import append_backward
import paddle.fluid.framework as framework import paddle.fluid.framework as framework
import gradient_checker
from decorator_helper import prog_scope
import paddle.fluid.layers as layers import paddle.fluid.layers as layers
from paddle.fluid import Program, program_guard
from paddle.fluid.backward import append_backward
class TestAssignOp(op_test.OpTest): class TestAssignOp(op_test.OpTest):
......
...@@ -12,9 +12,11 @@ ...@@ -12,9 +12,11 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import op_test
import numpy as np
import unittest import unittest
import numpy as np
import op_test
import paddle import paddle
import paddle.fluid.core as core import paddle.fluid.core as core
from paddle.distributed.models.moe import utils from paddle.distributed.models.moe import utils
......
...@@ -13,9 +13,10 @@ ...@@ -13,9 +13,10 @@
# limitations under the License. # limitations under the License.
import unittest import unittest
import numpy as np
import numpy as np
import op_test import op_test
import paddle import paddle
import paddle.fluid as fluid import paddle.fluid as fluid
import paddle.fluid.framework as framework import paddle.fluid.framework as framework
......
...@@ -13,10 +13,11 @@ ...@@ -13,10 +13,11 @@
# limitations under the License. # limitations under the License.
import os import os
import time
import unittest import unittest
import numpy import numpy
import time
import paddle import paddle
import paddle.fluid as fluid import paddle.fluid as fluid
......
...@@ -12,10 +12,11 @@ ...@@ -12,10 +12,11 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import numpy as np
import unittest import unittest
import numpy as np
from op_test import OpTest from op_test import OpTest
import paddle import paddle
import paddle.fluid.core as core import paddle.fluid.core as core
......
...@@ -13,9 +13,10 @@ ...@@ -13,9 +13,10 @@
# limitations under the License. # limitations under the License.
import unittest import unittest
import numpy as np import numpy as np
from op_test import OpTest from op_test import OpTest
from test_fusion_lstm_op import fc, ACTIVATION from test_fusion_lstm_op import ACTIVATION, fc
from test_softmax_op import stable_softmax from test_softmax_op import stable_softmax
......
...@@ -13,13 +13,14 @@ ...@@ -13,13 +13,14 @@
# limitations under the License. # limitations under the License.
import os import os
import unittest
import tempfile import tempfile
import unittest
import numpy as np
import paddle import paddle
import paddle.inference as paddle_infer import paddle.inference as paddle_infer
from paddle.fluid.framework import program_guard, Program from paddle.fluid.framework import OpProtoHolder, Program, program_guard
from paddle.fluid.framework import OpProtoHolder
import numpy as np
paddle.enable_static() paddle.enable_static()
......
...@@ -13,11 +13,13 @@ ...@@ -13,11 +13,13 @@
# limitations under the License. # limitations under the License.
import unittest import unittest
import numpy as np import numpy as np
from op_test import OpTest from op_test import OpTest
from paddle.fluid import metrics
import paddle.fluid as fluid
import paddle import paddle
import paddle.fluid as fluid
from paddle.fluid import metrics
class TestAucOp(OpTest): class TestAucOp(OpTest):
......
...@@ -13,8 +13,10 @@ ...@@ -13,8 +13,10 @@
# limitations under the License. # limitations under the License.
import unittest import unittest
import numpy as np import numpy as np
from op_test import OpTest from op_test import OpTest
from paddle.fluid import metrics from paddle.fluid import metrics
......
...@@ -12,10 +12,12 @@ ...@@ -12,10 +12,12 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import paddle.fluid as fluid
import unittest import unittest
import numpy as np import numpy as np
import paddle.fluid as fluid
fluid.core.globals()['FLAGS_allocator_strategy'] = 'auto_growth' fluid.core.globals()['FLAGS_allocator_strategy'] = 'auto_growth'
if fluid.is_compiled_with_cuda(): if fluid.is_compiled_with_cuda():
......
...@@ -12,13 +12,16 @@ ...@@ -12,13 +12,16 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import json
import os
import tempfile import tempfile
import unittest import unittest
import os
import json from paddle.distributed.auto_parallel.cluster import (
from paddle.distributed.auto_parallel.cluster import Cluster Cluster,
from paddle.distributed.auto_parallel.cluster import DeviceType DeviceType,
from paddle.distributed.auto_parallel.cluster import LinkType LinkType,
)
cluster_json = """ cluster_json = """
{ {
......
...@@ -17,14 +17,14 @@ import unittest.mock ...@@ -17,14 +17,14 @@ import unittest.mock
import paddle import paddle
import paddle.nn as nn import paddle.nn as nn
import paddle.static as static
import paddle.nn.functional as F import paddle.nn.functional as F
import paddle.utils as utils import paddle.static as static
import paddle.tensor as tensor import paddle.tensor as tensor
from paddle.fluid import layers import paddle.utils as utils
from paddle.distributed.fleet import auto
from paddle.distributed.auto_parallel.completion import Completer from paddle.distributed.auto_parallel.completion import Completer
from paddle.distributed.auto_parallel.dist_context import DistributedContext from paddle.distributed.auto_parallel.dist_context import DistributedContext
from paddle.distributed.fleet import auto
from paddle.fluid import layers
paddle.enable_static() paddle.enable_static()
_global_parallel_strategy = None _global_parallel_strategy = None
......
...@@ -18,14 +18,14 @@ import unittest ...@@ -18,14 +18,14 @@ import unittest
import paddle import paddle
import paddle.nn as nn import paddle.nn as nn
import paddle.nn.functional as F import paddle.nn.functional as F
import paddle.static as static
import paddle.tensor as tensor import paddle.tensor as tensor
import paddle.utils as utils import paddle.utils as utils
from paddle.fluid import layers
from paddle.nn.layer.transformer import _convert_param_attr_to_list
import paddle.static as static
from paddle.distributed.fleet import auto
from paddle.distributed.auto_parallel.completion import Completer from paddle.distributed.auto_parallel.completion import Completer
from paddle.distributed.auto_parallel.dist_context import DistributedContext from paddle.distributed.auto_parallel.dist_context import DistributedContext
from paddle.distributed.fleet import auto
from paddle.fluid import layers
from paddle.nn.layer.transformer import _convert_param_attr_to_list
paddle.enable_static() paddle.enable_static()
_global_parallel_strategy = None _global_parallel_strategy = None
......
...@@ -15,19 +15,19 @@ ...@@ -15,19 +15,19 @@
import unittest import unittest
import paddle import paddle
import paddle.fluid.core as core
import paddle.nn as nn import paddle.nn as nn
import paddle.static as static
import paddle.nn.functional as F import paddle.nn.functional as F
import paddle.static as static
import paddle.utils as utils import paddle.utils as utils
from paddle.distributed.fleet import auto from paddle.distributed import fleet
from paddle.distributed.auto_parallel.completion import Completer from paddle.distributed.auto_parallel.completion import Completer
from paddle.distributed.auto_parallel.cost_model import estimate_cost
from paddle.distributed.auto_parallel.dist_context import DistributedContext from paddle.distributed.auto_parallel.dist_context import DistributedContext
from paddle.distributed import fleet
from paddle.distributed.auto_parallel.partitioner import Partitioner
from paddle.distributed.auto_parallel.parallelizer import AutoParallelizer from paddle.distributed.auto_parallel.parallelizer import AutoParallelizer
from paddle.distributed.auto_parallel.partitioner import Partitioner
from paddle.distributed.auto_parallel.reshard import Resharder from paddle.distributed.auto_parallel.reshard import Resharder
from paddle.distributed.auto_parallel.cost_model import estimate_cost from paddle.distributed.fleet import auto
import paddle.fluid.core as core
paddle.enable_static() paddle.enable_static()
_global_parallel_strategy = "dp_mp_pp" _global_parallel_strategy = "dp_mp_pp"
......
...@@ -15,19 +15,20 @@ ...@@ -15,19 +15,20 @@
import copy import copy
import unittest import unittest
import test_auto_parallel_reshard
from test_auto_parallel_reshard import mlp_forward
import paddle import paddle
from paddle.distributed.fleet import auto
from paddle.distributed.auto_parallel.completion import Completer
from paddle.distributed import fleet from paddle.distributed import fleet
from paddle.distributed.auto_parallel.parallelizer import AutoParallelizer from paddle.distributed.auto_parallel.completion import Completer
from paddle.distributed.auto_parallel.partitioner import Partitioner
from paddle.distributed.auto_parallel.dist_context import DistributedContext
from paddle.distributed.auto_parallel.dist_tensor import DistributedTensor
from paddle.distributed.auto_parallel.dist_attribute import ( from paddle.distributed.auto_parallel.dist_attribute import (
TensorDistributedAttribute, TensorDistributedAttribute,
) )
import test_auto_parallel_reshard from paddle.distributed.auto_parallel.dist_context import DistributedContext
from test_auto_parallel_reshard import mlp_forward from paddle.distributed.auto_parallel.dist_tensor import DistributedTensor
from paddle.distributed.auto_parallel.parallelizer import AutoParallelizer
from paddle.distributed.auto_parallel.partitioner import Partitioner
from paddle.distributed.fleet import auto
def get_dist_prog( def get_dist_prog(
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
# limitations under the License. # limitations under the License.
import unittest import unittest
from paddle.distributed.auto_parallel.graph import Graph from paddle.distributed.auto_parallel.graph import Graph
......
...@@ -12,33 +12,34 @@ ...@@ -12,33 +12,34 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import json
import os
import tempfile import tempfile
import unittest import unittest
import os
import json
import numpy as np import numpy as np
import paddle import paddle
import paddle.nn as nn
import paddle.fluid as fluid import paddle.fluid as fluid
import paddle.nn as nn
import paddle.nn.functional as F import paddle.nn.functional as F
import paddle.utils as utils
import paddle.static as static import paddle.static as static
from paddle.fluid import core import paddle.utils as utils
from paddle.fluid import layers
from paddle.fluid.initializer import NumpyArrayInitializer
from paddle.distributed import fleet from paddle.distributed import fleet
from paddle.distributed.auto_parallel.cluster import Cluster
from paddle.distributed.fleet import auto
from paddle.distributed.auto_parallel.completion import Completer from paddle.distributed.auto_parallel.completion import Completer
from paddle.distributed.auto_parallel.parallelizer import AutoParallelizer
from paddle.distributed.auto_parallel.dist_context import DistributedContext from paddle.distributed.auto_parallel.dist_context import DistributedContext
from paddle.distributed.auto_parallel.mapper import (
get_comm_volume,
get_dtype_bytes,
mapping,
)
from paddle.distributed.auto_parallel.parallelizer import AutoParallelizer
from paddle.distributed.auto_parallel.partitioner import Partitioner from paddle.distributed.auto_parallel.partitioner import Partitioner
from paddle.distributed.auto_parallel.reshard import Resharder from paddle.distributed.auto_parallel.reshard import Resharder
from paddle.distributed.auto_parallel.cluster import Cluster from paddle.distributed.fleet import auto
from paddle.distributed.auto_parallel.mapper import mapping from paddle.fluid import core, layers
from paddle.distributed.auto_parallel.mapper import get_dtype_bytes from paddle.fluid.initializer import NumpyArrayInitializer
from paddle.distributed.auto_parallel.mapper import get_comm_volume
if os.getenv("CUDA_VISIBLE_DEVICES") is not None: if os.getenv("CUDA_VISIBLE_DEVICES") is not None:
os.environ["CUDA_VISIBLE_DEVICES"] = "" os.environ["CUDA_VISIBLE_DEVICES"] = ""
......
...@@ -17,18 +17,18 @@ import unittest.mock ...@@ -17,18 +17,18 @@ import unittest.mock
import paddle import paddle
import paddle.nn as nn import paddle.nn as nn
import paddle.static as static
import paddle.nn.functional as F import paddle.nn.functional as F
import paddle.utils as utils import paddle.static as static
import paddle.tensor as tensor import paddle.tensor as tensor
from paddle.fluid import layers import paddle.utils as utils
from paddle.distributed.fleet import auto from paddle.distributed import fleet
from paddle.distributed.auto_parallel.completion import Completer from paddle.distributed.auto_parallel.completion import Completer
from paddle.distributed.auto_parallel.dist_context import DistributedContext from paddle.distributed.auto_parallel.dist_context import DistributedContext
from paddle.distributed import fleet
from paddle.distributed.auto_parallel.partitioner import Partitioner from paddle.distributed.auto_parallel.partitioner import Partitioner
from paddle.distributed.auto_parallel.utils import _get_comm_group
from paddle.distributed.auto_parallel.process_group import new_process_group from paddle.distributed.auto_parallel.process_group import new_process_group
from paddle.distributed.auto_parallel.utils import _get_comm_group
from paddle.distributed.fleet import auto
from paddle.fluid import layers
paddle.enable_static() paddle.enable_static()
_global_parallel_strategy = None _global_parallel_strategy = None
......
...@@ -18,17 +18,17 @@ import unittest ...@@ -18,17 +18,17 @@ import unittest
import paddle import paddle
import paddle.nn as nn import paddle.nn as nn
import paddle.nn.functional as F import paddle.nn.functional as F
import paddle.static as static
import paddle.tensor as tensor import paddle.tensor as tensor
import paddle.utils as utils import paddle.utils as utils
from paddle.fluid import layers
from paddle.nn.layer.transformer import _convert_param_attr_to_list
import paddle.static as static
from paddle.distributed.fleet import auto
from paddle.distributed.auto_parallel.completion import Completer from paddle.distributed.auto_parallel.completion import Completer
from paddle.distributed.auto_parallel.partitioner import Partitioner
from paddle.distributed.auto_parallel.parallelizer import AutoParallelizer from paddle.distributed.auto_parallel.parallelizer import AutoParallelizer
from paddle.distributed.auto_parallel.utils import _get_comm_group from paddle.distributed.auto_parallel.partitioner import Partitioner
from paddle.distributed.auto_parallel.process_group import new_process_group from paddle.distributed.auto_parallel.process_group import new_process_group
from paddle.distributed.auto_parallel.utils import _get_comm_group
from paddle.distributed.fleet import auto
from paddle.fluid import layers
from paddle.nn.layer.transformer import _convert_param_attr_to_list
paddle.enable_static() paddle.enable_static()
_global_parallel_strategy = None _global_parallel_strategy = None
......
...@@ -16,20 +16,20 @@ import unittest ...@@ -16,20 +16,20 @@ import unittest
import paddle import paddle
import paddle.nn as nn import paddle.nn as nn
import paddle.static as static
import paddle.nn.functional as F import paddle.nn.functional as F
import paddle.static as static
import paddle.utils as utils import paddle.utils as utils
from paddle.distributed.fleet import auto from paddle.distributed import fleet
from paddle.distributed.auto_parallel.completion import Completer from paddle.distributed.auto_parallel.completion import Completer
from paddle.distributed.auto_parallel.dist_context import DistributedContext from paddle.distributed.auto_parallel.dist_context import DistributedContext
from paddle.distributed import fleet
from paddle.distributed.auto_parallel.parallelizer import AutoParallelizer from paddle.distributed.auto_parallel.parallelizer import AutoParallelizer
from paddle.distributed.auto_parallel.partitioner import Partitioner from paddle.distributed.auto_parallel.partitioner import Partitioner
from paddle.distributed.auto_parallel.reshard import Resharder
from paddle.distributed.auto_parallel.process_group import ( from paddle.distributed.auto_parallel.process_group import (
_g_process_group_map,
ProcessGroup, ProcessGroup,
_g_process_group_map,
) )
from paddle.distributed.auto_parallel.reshard import Resharder
from paddle.distributed.fleet import auto
paddle.enable_static() paddle.enable_static()
_global_parallel_strategy = None _global_parallel_strategy = None
......
...@@ -16,18 +16,18 @@ import unittest ...@@ -16,18 +16,18 @@ import unittest
import paddle import paddle
import paddle.nn as nn import paddle.nn as nn
import paddle.static as static
import paddle.nn.functional as F import paddle.nn.functional as F
import paddle.static as static
import paddle.utils as utils import paddle.utils as utils
from paddle.distributed.fleet import auto from paddle.distributed import fleet
from paddle.distributed.auto_parallel.cluster import Cluster
from paddle.distributed.auto_parallel.completion import Completer from paddle.distributed.auto_parallel.completion import Completer
from paddle.distributed.auto_parallel.cost import CostEstimator
from paddle.distributed.auto_parallel.dist_context import DistributedContext from paddle.distributed.auto_parallel.dist_context import DistributedContext
from paddle.distributed import fleet
from paddle.distributed.auto_parallel.parallelizer import AutoParallelizer from paddle.distributed.auto_parallel.parallelizer import AutoParallelizer
from paddle.distributed.auto_parallel.partitioner import Partitioner from paddle.distributed.auto_parallel.partitioner import Partitioner
from paddle.distributed.auto_parallel.reshard import Resharder from paddle.distributed.auto_parallel.reshard import Resharder
from paddle.distributed.auto_parallel.cost import CostEstimator from paddle.distributed.fleet import auto
from paddle.distributed.auto_parallel.cluster import Cluster
paddle.enable_static() paddle.enable_static()
_global_parallel_strategy = "dp_mp_pp" _global_parallel_strategy = "dp_mp_pp"
......
...@@ -16,18 +16,18 @@ import unittest ...@@ -16,18 +16,18 @@ import unittest
import paddle import paddle
import paddle.nn as nn import paddle.nn as nn
import paddle.static as static
import paddle.nn.functional as F import paddle.nn.functional as F
import paddle.static as static
import paddle.utils as utils import paddle.utils as utils
from paddle.distributed.fleet import auto from paddle.distributed import fleet
from paddle.distributed.auto_parallel.cluster import Cluster
from paddle.distributed.auto_parallel.completion import Completer from paddle.distributed.auto_parallel.completion import Completer
from paddle.distributed.auto_parallel.cost import CostEstimator
from paddle.distributed.auto_parallel.dist_context import DistributedContext from paddle.distributed.auto_parallel.dist_context import DistributedContext
from paddle.distributed import fleet
from paddle.distributed.auto_parallel.parallelizer import AutoParallelizer from paddle.distributed.auto_parallel.parallelizer import AutoParallelizer
from paddle.distributed.auto_parallel.partitioner import Partitioner from paddle.distributed.auto_parallel.partitioner import Partitioner
from paddle.distributed.auto_parallel.reshard import Resharder from paddle.distributed.auto_parallel.reshard import Resharder
from paddle.distributed.auto_parallel.cost import CostEstimator from paddle.distributed.fleet import auto
from paddle.distributed.auto_parallel.cluster import Cluster
paddle.enable_static() paddle.enable_static()
_global_parallel_strategy = "mp_pp" _global_parallel_strategy = "mp_pp"
......
...@@ -12,23 +12,22 @@ ...@@ -12,23 +12,22 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import unittest
import os import os
import unittest
if os.getenv("CUDA_VISIBLE_DEVICES", None) is None: if os.getenv("CUDA_VISIBLE_DEVICES", None) is None:
os.environ["CUDA_VISIBLE_DEVICES"] = '0' os.environ["CUDA_VISIBLE_DEVICES"] = '0'
import paddle import paddle
import paddle.nn as nn import paddle.nn as nn
import paddle.static as static
import paddle.nn.functional as F import paddle.nn.functional as F
import paddle.static as static
import paddle.utils as utils import paddle.utils as utils
from paddle.distributed.fleet import auto from paddle.distributed import fleet
from paddle.distributed.auto_parallel.dist_context import ( from paddle.distributed.auto_parallel.dist_context import (
get_default_distributed_context, get_default_distributed_context,
) )
from paddle.distributed import fleet from paddle.distributed.fleet import auto
paddle.enable_static() paddle.enable_static()
_global_parallel_strategy = None _global_parallel_strategy = None
......
...@@ -16,24 +16,20 @@ import unittest ...@@ -16,24 +16,20 @@ import unittest
import paddle import paddle
import paddle.nn as nn import paddle.nn as nn
import paddle.static as static
import paddle.nn.functional as F import paddle.nn.functional as F
import paddle.static as static
import paddle.utils as utils import paddle.utils as utils
from paddle.distributed.fleet import auto
from paddle.distributed.auto_parallel.planner import PlanSpace
from paddle.distributed.auto_parallel.dist_context import DistributedContext
from paddle.distributed.auto_parallel.dist_attribute import (
TensorDistributedAttribute,
)
from paddle.distributed.auto_parallel.dist_attribute import ( from paddle.distributed.auto_parallel.dist_attribute import (
OperatorDistributedAttribute, OperatorDistributedAttribute,
TensorDistributedAttribute,
) )
from paddle.distributed.auto_parallel.dist_context import DistributedContext
from paddle.distributed.auto_parallel.planner import PlanSpace
from paddle.distributed.auto_parallel.utils import ( from paddle.distributed.auto_parallel.utils import (
update_op_dims_mapping_by_default_dist_impl, update_op_dims_mapping_by_default_dist_impl,
)
from paddle.distributed.auto_parallel.utils import (
update_op_dims_mapping_by_elementwise_like_dist_impl, update_op_dims_mapping_by_elementwise_like_dist_impl,
) )
from paddle.distributed.fleet import auto
paddle.enable_static() paddle.enable_static()
...@@ -183,13 +179,11 @@ class TestMLPSearcher(unittest.TestCase): ...@@ -183,13 +179,11 @@ class TestMLPSearcher(unittest.TestCase):
set_default_dist_attr(train_program, dist_context, global_process_mesh) set_default_dist_attr(train_program, dist_context, global_process_mesh)
ops = train_program.global_block().ops ops = train_program.global_block().ops
vars = train_program.global_block().vars vars = train_program.global_block().vars
from paddle.distributed.auto_parallel.dist_op import DistributedOperator
from paddle.distributed.auto_parallel.operators.common import ( from paddle.distributed.auto_parallel.operators.common import (
get_distributed_operator_impl_container, get_distributed_operator_impl_container,
)
from paddle.distributed.auto_parallel.operators.common import (
is_elementwise_op, is_elementwise_op,
) )
from paddle.distributed.auto_parallel.dist_op import DistributedOperator
for op in ops: for op in ops:
dist_op_impl_container = get_distributed_operator_impl_container( dist_op_impl_container = get_distributed_operator_impl_container(
......
...@@ -14,19 +14,19 @@ ...@@ -14,19 +14,19 @@
import unittest import unittest
import paddle import paddle
import paddle.fluid.core as core
import paddle.nn as nn import paddle.nn as nn
import paddle.static as static
import paddle.nn.functional as F import paddle.nn.functional as F
import paddle.static as static
import paddle.utils as utils import paddle.utils as utils
import paddle.fluid.core as core
from paddle.fluid import layers
from paddle.distributed.auto_parallel.operators.common import (
get_distributed_operator_impl_container,
)
from paddle.distributed.auto_parallel.dist_attribute import ( from paddle.distributed.auto_parallel.dist_attribute import (
OperatorDistributedAttribute, OperatorDistributedAttribute,
) )
from paddle.distributed.auto_parallel.dist_op import DistributedOperator from paddle.distributed.auto_parallel.dist_op import DistributedOperator
from paddle.distributed.auto_parallel.operators.common import (
get_distributed_operator_impl_container,
)
from paddle.fluid import layers
paddle.enable_static() paddle.enable_static()
device = "gpu" if core.is_compiled_with_cuda() else "cpu" device = "gpu" if core.is_compiled_with_cuda() else "cpu"
......
...@@ -14,19 +14,19 @@ ...@@ -14,19 +14,19 @@
import unittest import unittest
import paddle import paddle
import paddle.fluid.core as core
import paddle.nn as nn import paddle.nn as nn
import paddle.static as static
import paddle.nn.functional as F import paddle.nn.functional as F
import paddle.static as static
import paddle.utils as utils import paddle.utils as utils
import paddle.fluid.core as core
from paddle.fluid import layers
from paddle.distributed.auto_parallel.operators.common import (
get_distributed_operator_impl_container,
)
from paddle.distributed.auto_parallel.dist_attribute import ( from paddle.distributed.auto_parallel.dist_attribute import (
OperatorDistributedAttribute, OperatorDistributedAttribute,
) )
from paddle.distributed.auto_parallel.dist_op import DistributedOperator from paddle.distributed.auto_parallel.dist_op import DistributedOperator
from paddle.distributed.auto_parallel.operators.common import (
get_distributed_operator_impl_container,
)
from paddle.fluid import layers
paddle.enable_static() paddle.enable_static()
device = "gpu" if core.is_compiled_with_cuda() else "cpu" device = "gpu" if core.is_compiled_with_cuda() else "cpu"
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
# limitations under the License. # limitations under the License.
import unittest import unittest
import paddle.fluid as fluid import paddle.fluid as fluid
......
...@@ -13,12 +13,13 @@ ...@@ -13,12 +13,13 @@
# limitations under the License. # limitations under the License.
import unittest import unittest
import paddle.fluid as fluid
import paddle.static as static
import paddle
import numpy as np import numpy as np
import paddle
import paddle.fluid as fluid
import paddle.static as static
class BackwardNet: class BackwardNet:
""" """
......
...@@ -13,10 +13,12 @@ ...@@ -13,10 +13,12 @@
# limitations under the License. # limitations under the License.
import unittest import unittest
import paddle.fluid as fluid import warnings
import numpy as np import numpy as np
import paddle import paddle
import warnings import paddle.fluid as fluid
class TestBackwardInferVarDataTypeShape(unittest.TestCase): class TestBackwardInferVarDataTypeShape(unittest.TestCase):
......
...@@ -13,14 +13,19 @@ ...@@ -13,14 +13,19 @@
# limitations under the License. # limitations under the License.
import unittest import unittest
import numpy as np import numpy as np
import paddle import paddle
import paddle.fluid as fluid import paddle.fluid as fluid
from paddle.fluid.dygraph import to_variable from paddle.fluid.dygraph import to_variable
from paddle.fluid.framework import ParamBase, EagerParamBase from paddle.fluid.framework import (
EagerParamBase,
ParamBase,
_test_eager_guard,
in_dygraph_mode,
)
from paddle.jit import ProgramTranslator from paddle.jit import ProgramTranslator
from paddle.fluid.framework import _test_eager_guard, in_dygraph_mode
class L1(fluid.Layer): class L1(fluid.Layer):
......
...@@ -13,15 +13,16 @@ ...@@ -13,15 +13,16 @@
# limitations under the License. # limitations under the License.
import unittest import unittest
import numpy import numpy
import numpy as np
import paddle.fluid as fluid import paddle.fluid as fluid
import paddle.fluid.layers as layers
import paddle.fluid.core as core import paddle.fluid.core as core
import paddle.fluid.layers as layers
from paddle.fluid import framework
from paddle.fluid.contrib.layers import basic_gru from paddle.fluid.contrib.layers import basic_gru
from paddle.fluid.executor import Executor from paddle.fluid.executor import Executor
from paddle.fluid import framework
import numpy as np
np.set_seed(123) np.set_seed(123)
......
...@@ -13,15 +13,16 @@ ...@@ -13,15 +13,16 @@
# limitations under the License. # limitations under the License.
import unittest import unittest
import numpy import numpy
import numpy as np
import paddle.fluid as fluid import paddle.fluid as fluid
import paddle.fluid.layers as layers
import paddle.fluid.core as core import paddle.fluid.core as core
import paddle.fluid.layers as layers
from paddle.fluid import framework
from paddle.fluid.contrib.layers import BasicGRUUnit from paddle.fluid.contrib.layers import BasicGRUUnit
from paddle.fluid.executor import Executor from paddle.fluid.executor import Executor
from paddle.fluid import framework
import numpy as np
np.set_seed(123) np.set_seed(123)
......
...@@ -13,15 +13,16 @@ ...@@ -13,15 +13,16 @@
# limitations under the License. # limitations under the License.
import unittest import unittest
import numpy import numpy
import numpy as np
import paddle.fluid as fluid import paddle.fluid as fluid
import paddle.fluid.layers as layers
import paddle.fluid.core as core import paddle.fluid.core as core
import paddle.fluid.layers as layers
from paddle.fluid import framework
from paddle.fluid.contrib.layers import basic_lstm from paddle.fluid.contrib.layers import basic_lstm
from paddle.fluid.executor import Executor from paddle.fluid.executor import Executor
from paddle.fluid import framework
import numpy as np
np.set_seed(123) np.set_seed(123)
......
...@@ -13,15 +13,16 @@ ...@@ -13,15 +13,16 @@
# limitations under the License. # limitations under the License.
import unittest import unittest
import numpy import numpy
import numpy as np
import paddle.fluid as fluid import paddle.fluid as fluid
import paddle.fluid.layers as layers
import paddle.fluid.core as core import paddle.fluid.core as core
import paddle.fluid.layers as layers
from paddle.fluid import framework
from paddle.fluid.contrib.layers import BasicLSTMUnit from paddle.fluid.contrib.layers import BasicLSTMUnit
from paddle.fluid.executor import Executor from paddle.fluid.executor import Executor
from paddle.fluid import framework
import numpy as np
np.set_seed(123) np.set_seed(123)
......
...@@ -13,10 +13,12 @@ ...@@ -13,10 +13,12 @@
# limitations under the License. # limitations under the License.
import unittest import unittest
from test_imperative_base import new_program_scope
import paddle.fluid as fluid import paddle.fluid as fluid
import paddle.fluid.layers as layers import paddle.fluid.layers as layers
from paddle.fluid.contrib.layers import basic_gru, basic_lstm from paddle.fluid.contrib.layers import basic_gru, basic_lstm
from test_imperative_base import new_program_scope
class TestBasicGRUApiName(unittest.TestCase): class TestBasicGRUApiName(unittest.TestCase):
......
...@@ -13,9 +13,10 @@ ...@@ -13,9 +13,10 @@
# limitations under the License. # limitations under the License.
import unittest import unittest
import numpy as np import numpy as np
from op_test import OpTest from op_test import OpTest
from op_test import OpTest
import paddle.fluid.core as core import paddle.fluid.core as core
......
...@@ -14,15 +14,16 @@ ...@@ -14,15 +14,16 @@
import os import os
import unittest import unittest
import numpy as np import numpy as np
import paddle
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 op_test import OpTest, _set_use_system_allocator
from paddle.fluid.framework import grad_var_name
import paddle
import paddle.fluid as fluid import paddle.fluid as fluid
import paddle.fluid.core as core
from paddle.fluid import Program, program_guard from paddle.fluid import Program, program_guard
from paddle.fluid.framework import grad_var_name
from paddle.fluid.op import Operator
_set_use_system_allocator(True) _set_use_system_allocator(True)
......
...@@ -13,13 +13,14 @@ ...@@ -13,13 +13,14 @@
# limitations under the License. # limitations under the License.
import unittest import unittest
import numpy as np import numpy as np
import paddle.fluid.core as core
import paddle.fluid as fluid import paddle
from paddle.fluid.framework import _test_eager_guard
import paddle.fluid as fluid import paddle.fluid as fluid
import paddle.fluid.core as core
from paddle.fluid import Program, program_guard from paddle.fluid import Program, program_guard
import paddle from paddle.fluid.framework import _test_eager_guard
class TestBatchNorm(unittest.TestCase): class TestBatchNorm(unittest.TestCase):
......
...@@ -15,12 +15,13 @@ ...@@ -15,12 +15,13 @@
import unittest import unittest
import numpy as np import numpy as np
from paddle.io import ( from paddle.io import (
BatchSampler, BatchSampler,
Dataset, Dataset,
RandomSampler,
Sampler, Sampler,
SequenceSampler, SequenceSampler,
RandomSampler,
WeightedRandomSampler, WeightedRandomSampler,
) )
......
...@@ -12,12 +12,14 @@ ...@@ -12,12 +12,14 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import paddle
import paddle.fluid as fluid
import numpy as np
import unittest import unittest
import numpy as np
from op_test import OpTest from op_test import OpTest
import paddle
import paddle.fluid as fluid
def test_static_layer( def test_static_layer(
place, input_np, label_np, reduction='mean', weight_np=None place, input_np, label_np, reduction='mean', weight_np=None
......
...@@ -12,10 +12,12 @@ ...@@ -12,10 +12,12 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import unittest
import numpy as np
import paddle import paddle
import paddle.fluid as fluid import paddle.fluid as fluid
import numpy as np
import unittest
from paddle.fluid.framework import _test_eager_guard from paddle.fluid.framework import _test_eager_guard
......
...@@ -15,10 +15,11 @@ ...@@ -15,10 +15,11 @@
import unittest import unittest
import numpy as np import numpy as np
import paddle.fluid.core as core
from paddle.fluid.op import Operator
import paddle.fluid as fluid import paddle.fluid as fluid
import paddle.fluid.core as core
from paddle.fluid.framework import Program, program_guard from paddle.fluid.framework import Program, program_guard
from paddle.fluid.op import Operator
class TestBeamSearchDecodeOp(unittest.TestCase): class TestBeamSearchDecodeOp(unittest.TestCase):
......
...@@ -12,13 +12,15 @@ ...@@ -12,13 +12,15 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from paddle.fluid.op import Operator
import paddle.fluid.core as core
import unittest import unittest
import numpy as np import numpy as np
import paddle
import paddle.fluid as fluid import paddle.fluid as fluid
import paddle.fluid.core as core
from paddle.fluid.framework import Program, program_guard from paddle.fluid.framework import Program, program_guard
import paddle from paddle.fluid.op import Operator
def create_tensor(scope, name, np_data): def create_tensor(scope, name, np_data):
......
...@@ -13,9 +13,11 @@ ...@@ -13,9 +13,11 @@
# limitations under the License. # limitations under the License.
import unittest import unittest
import paddle
from op_test import OpTest
import numpy as np import numpy as np
from op_test import OpTest
import paddle
def output_hist(out): def output_hist(out):
......
...@@ -18,9 +18,8 @@ import numpy as np ...@@ -18,9 +18,8 @@ import numpy as np
import paddle import paddle
import paddle.nn.functional as F import paddle.nn.functional as F
from paddle.incubate.optimizer.functional.bfgs import minimize_bfgs
from paddle.fluid.framework import _test_eager_guard from paddle.fluid.framework import _test_eager_guard
from paddle.incubate.optimizer.functional.bfgs import minimize_bfgs
np.random.seed(123) np.random.seed(123)
......
...@@ -12,12 +12,14 @@ ...@@ -12,12 +12,14 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import paddle
import numpy as np
import unittest import unittest
import paddle.nn.functional as F
import numpy as np
from test_sparse_attention_op import get_cuda_version from test_sparse_attention_op import get_cuda_version
import paddle
import paddle.nn.functional as F
class BF16EmbeddingTest(unittest.TestCase): class BF16EmbeddingTest(unittest.TestCase):
def setUp(self): def setUp(self):
......
...@@ -13,10 +13,12 @@ ...@@ -13,10 +13,12 @@
# limitations under the License. # limitations under the License.
import unittest import unittest
import numpy as np import numpy as np
from op_test import OpTest from op_test import OpTest
import paddle.fluid as fluid
import paddle import paddle
import paddle.fluid as fluid
from paddle.fluid import Program, program_guard from paddle.fluid import Program, program_guard
from paddle.nn.functional import interpolate from paddle.nn.functional import interpolate
......
...@@ -13,10 +13,12 @@ ...@@ -13,10 +13,12 @@
# limitations under the License. # limitations under the License.
import unittest import unittest
import numpy as np import numpy as np
from op_test import OpTest from op_test import OpTest
import paddle.fluid as fluid
import paddle import paddle
import paddle.fluid as fluid
from paddle.fluid import Program, program_guard from paddle.fluid import Program, program_guard
from paddle.fluid.framework import _test_eager_guard from paddle.fluid.framework import _test_eager_guard
from paddle.nn.functional import interpolate from paddle.nn.functional import interpolate
......
...@@ -12,11 +12,13 @@ ...@@ -12,11 +12,13 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import math
import unittest import unittest
import numpy as np import numpy as np
from op_test import OpTest from op_test import OpTest
import paddle import paddle
import math
class Gsz: class Gsz:
......
...@@ -14,10 +14,11 @@ ...@@ -14,10 +14,11 @@
import unittest import unittest
import numpy as np
import paddle import paddle
import paddle.fluid as fluid import paddle.fluid as fluid
import paddle.fluid.core as core import paddle.fluid.core as core
import numpy as np
class TestBilinearAPI(unittest.TestCase): class TestBilinearAPI(unittest.TestCase):
......
...@@ -13,11 +13,13 @@ ...@@ -13,11 +13,13 @@
# limitations under the License. # limitations under the License.
import unittest import unittest
import numpy as np import numpy as np
from op_test import OpTest from op_test import OpTest
import paddle.fluid.core as core
import paddle.fluid as fluid
import paddle import paddle
import paddle.fluid as fluid
import paddle.fluid.core as core
paddle.enable_static() paddle.enable_static()
......
...@@ -13,12 +13,14 @@ ...@@ -13,12 +13,14 @@
# limitations under the License. # limitations under the License.
import unittest import unittest
import numpy as np import numpy as np
from op_test import OpTest from op_test import OpTest
import paddle.fluid.core as core
import paddle
import paddle.fluid as fluid import paddle.fluid as fluid
import paddle.fluid.core as core
from paddle.nn.functional import interpolate from paddle.nn.functional import interpolate
import paddle
def bilinear_interp_test( def bilinear_interp_test(
......
...@@ -13,10 +13,12 @@ ...@@ -13,10 +13,12 @@
# limitations under the License. # limitations under the License.
import unittest import unittest
import numpy as np import numpy as np
import paddle.fluid as fluid
from op_test import OpTest from op_test import OpTest
import paddle import paddle
import paddle.fluid as fluid
class TestDygraphBilinearTensorProductAPIError(unittest.TestCase): class TestDygraphBilinearTensorProductAPIError(unittest.TestCase):
......
...@@ -13,12 +13,14 @@ ...@@ -13,12 +13,14 @@
# limitations under the License. # limitations under the License.
import os import os
import unittest
import tempfile import tempfile
import unittest
import numpy as np import numpy as np
from op_test import OpTest
import paddle import paddle
import paddle.fluid as fluid import paddle.fluid as fluid
from op_test import OpTest
import paddle.inference as paddle_infer import paddle.inference as paddle_infer
from paddle.fluid.framework import in_dygraph_mode from paddle.fluid.framework import in_dygraph_mode
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
# limitations under the License. # limitations under the License.
import unittest import unittest
import numpy as np import numpy as np
from op_test import OpTest from op_test import OpTest
......
...@@ -13,10 +13,12 @@ ...@@ -13,10 +13,12 @@
# limitations under the License. # limitations under the License.
import unittest import unittest
import numpy as np import numpy as np
import paddle
from op_test import OpTest from op_test import OpTest
import paddle
paddle.enable_static() paddle.enable_static()
......
...@@ -13,8 +13,10 @@ ...@@ -13,8 +13,10 @@
# limitations under the License. # limitations under the License.
import unittest import unittest
import numpy as np import numpy as np
from op_test import OpTest from op_test import OpTest
import paddle import paddle
import paddle.fluid as fluid import paddle.fluid as fluid
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
# limitations under the License. # limitations under the License.
import unittest import unittest
import numpy as np import numpy as np
from op_test import OpTest from op_test import OpTest
......
...@@ -13,8 +13,10 @@ ...@@ -13,8 +13,10 @@
# limitations under the License. # limitations under the License.
import unittest import unittest
import numpy as np import numpy as np
from op_test import OpTest from op_test import OpTest
import paddle import paddle
import paddle.fluid.core as core import paddle.fluid.core as core
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
# limitations under the License. # limitations under the License.
import unittest import unittest
import numpy as np import numpy as np
from op_test import OpTest from op_test import OpTest
......
...@@ -12,10 +12,11 @@ ...@@ -12,10 +12,11 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import unittest
import paddle import paddle
import paddle.fluid as fluid import paddle.fluid as fluid
import paddle.fluid.core as core import paddle.fluid.core as core
import unittest
from paddle.fluid.layers.nn import _pull_box_sparse from paddle.fluid.layers.nn import _pull_box_sparse
from paddle.fluid.transpiler import collective from paddle.fluid.transpiler import collective
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
# limitations under the License. # limitations under the License.
import unittest import unittest
import numpy as np import numpy as np
from op_test import OpTest, randomize_probability from op_test import OpTest, randomize_probability
......
...@@ -13,8 +13,10 @@ ...@@ -13,8 +13,10 @@
# limitations under the License. # limitations under the License.
import unittest import unittest
import numpy as np import numpy as np
from op_test import OpTest from op_test import OpTest
import paddle.fluid.core as core import paddle.fluid.core as core
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
# limitations under the License. # limitations under the License.
import unittest import unittest
import paddle import paddle
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册