未验证 提交 827ac36f 编写于 作者: P pangyoki 提交者: GitHub

Use dygraph mode by default (#27443)

* default open dygraph mode

* fix CI-Mac

* fix Mac-CI other unittest file

* fix CI-Py3

* fix test_communicator_geo and test_buffer_shared_memory_reuse_pass

* add enable_static to fix CI-Py3

* add enable_static to fix CI-coverage

* delete try except
上级 0a862fd3
......@@ -276,3 +276,5 @@ from .hapi import callbacks
from .hapi import summary
import paddle.text
import paddle.vision
disable_static()
......@@ -19,6 +19,9 @@ import argparse
import paddle.fluid as fluid
from paddle.fluid.framework import IrGraph
from paddle.fluid import core
import paddle
paddle.enable_static()
def parse_args():
......
......@@ -27,6 +27,8 @@ from paddle.fluid.framework import IrGraph
from paddle.fluid.contrib.slim.quantization import Quant2Int8MkldnnPass
from paddle.fluid import core
paddle.enable_static()
logging.basicConfig(format='%(asctime)s-%(levelname)s: %(message)s')
_logger = logging.getLogger(__name__)
_logger.setLevel(logging.INFO)
......
......@@ -25,6 +25,8 @@ from paddle.fluid.framework import IrGraph
from paddle.fluid.contrib.slim.quantization import Quant2Int8MkldnnPass
from paddle.fluid import core
paddle.enable_static()
logging.basicConfig(format='%(asctime)s-%(levelname)s: %(message)s')
_logger = logging.getLogger(__name__)
_logger.setLevel(logging.INFO)
......
......@@ -27,6 +27,8 @@ from paddle.fluid.framework import IrGraph
from paddle.fluid.contrib.slim.quantization import QuantInt8MkldnnPass
from paddle.fluid import core
paddle.enable_static()
logging.basicConfig(format='%(asctime)s-%(levelname)s: %(message)s')
_logger = logging.getLogger(__name__)
_logger.setLevel(logging.INFO)
......
......@@ -27,6 +27,8 @@ from paddle.fluid.framework import IrGraph
from paddle.fluid.contrib.slim.quantization import Quant2Int8MkldnnPass
from paddle.fluid import core
paddle.enable_static()
def parse_args():
parser = argparse.ArgumentParser()
......
......@@ -22,6 +22,8 @@ import paddle.fluid as fluid
from paddle.fluid.framework import IrGraph
from paddle.fluid import core
paddle.enable_static()
os.environ["CUDA_VISIBLE_DEVICES"] = "0"
os.environ["CPU_NUM"] = "1"
......
......@@ -32,6 +32,8 @@ from paddle.fluid.dygraph.nn import Pool2D
from paddle.fluid.dygraph.nn import Linear
from paddle.fluid.log_helper import get_logger
paddle.enable_static()
os.environ["CPU_NUM"] = "1"
if core.is_compiled_with_cuda():
fluid.set_flags({"FLAGS_cudnn_deterministic": True})
......
......@@ -32,6 +32,8 @@ from paddle.fluid.dygraph.nn import Pool2D
from paddle.fluid.dygraph.nn import Linear
from paddle.fluid.log_helper import get_logger
paddle.enable_static()
os.environ["CPU_NUM"] = "1"
if core.is_compiled_with_cuda():
fluid.set_flags({"FLAGS_cudnn_deterministic": True})
......
......@@ -25,6 +25,8 @@ import paddle.fluid as fluid
from paddle.dataset.common import download
from paddle.fluid.contrib.slim.quantization import PostTrainingQuantization
paddle.enable_static()
random.seed(0)
np.random.seed(0)
......
......@@ -26,6 +26,8 @@ import paddle.fluid as fluid
from paddle.dataset.common import download
from paddle.fluid.contrib.slim.quantization import PostTrainingQuantization
paddle.enable_static()
random.seed(0)
np.random.seed(0)
......
......@@ -15,6 +15,9 @@
import sys
import unittest
from test_post_training_quantization_mobilenetv1 import TestPostTrainingQuantization
import paddle
paddle.enable_static()
class TestPostTrainingForResnet50(TestPostTrainingQuantization):
......
......@@ -18,6 +18,9 @@ import paddle.fluid as fluid
import paddle.fluid.core as core
from paddle.fluid.framework import IrGraph
from paddle.fluid.contrib.slim.quantization import Quant2Int8MkldnnPass
import paddle
paddle.enable_static()
class TestQuant2Int8MkldnnPass(unittest.TestCase):
......
......@@ -25,6 +25,7 @@ from paddle.fluid.contrib.slim.quantization import QuantizationTransformPass
from paddle.fluid.contrib.slim.quantization import QuantInt8MkldnnPass
from paddle.fluid import core
paddle.enable_static()
os.environ["CPU_NUM"] = "1"
......
......@@ -27,6 +27,8 @@ from paddle.fluid.contrib.slim.quantization import TransformForMobilePass
from paddle.fluid.contrib.slim.quantization import AddQuantDequantPass
from paddle.fluid import core
paddle.enable_static()
os.environ["CUDA_VISIBLE_DEVICES"] = "0"
os.environ["CPU_NUM"] = "1"
......
......@@ -27,6 +27,8 @@ from paddle.fluid.contrib.slim.quantization import OutScaleForInferencePass
from paddle.fluid.contrib.slim.quantization import AddQuantDequantPass
from paddle.fluid import core
paddle.enable_static()
os.environ["CUDA_VISIBLE_DEVICES"] = "0"
os.environ["CPU_NUM"] = "1"
......
......@@ -29,6 +29,8 @@ from paddle.fluid.contrib.slim.quantization import AddQuantDequantPass
from paddle.fluid import core
from paddle.fluid.layer_helper import LayerHelper
paddle.enable_static()
os.environ["CUDA_VISIBLE_DEVICES"] = "0"
os.environ["CPU_NUM"] = "1"
......
......@@ -17,6 +17,9 @@ import os
import time
from paddle.dataset.common import download, DATA_HOME
from paddle.fluid.contrib.slim.quantization import WeightQuantization
import paddle
paddle.enable_static()
class TestWeightQuantization(unittest.TestCase):
......
......@@ -16,6 +16,9 @@ import unittest
import numpy as np
import paddle.fluid as fluid
from paddle.fluid.dygraph.base import to_variable
import paddle
paddle.enable_static()
def corr(x_1,
......
......@@ -16,6 +16,9 @@ import unittest
import paddle.fluid as fluid
from paddle.fluid import core
from paddle.fluid.contrib.mixed_precision import fp16_utils
import paddle
paddle.enable_static()
class AMPTest(unittest.TestCase):
......
......@@ -25,6 +25,8 @@ import os
import copy
import numpy as np
paddle.enable_static()
def resnet_cifar10(input, depth=32):
def conv_bn_layer(input,
......
......@@ -20,6 +20,9 @@ import paddle
import paddle.fluid as fluid
from paddle.fluid.contrib.quantize.quantize_transpiler import _original_var_name
from paddle.fluid.contrib.quantize.quantize_transpiler import QuantizeTranspiler
import paddle
paddle.enable_static()
def linear_fc(num):
......
......@@ -21,6 +21,8 @@ import paddle
import paddle.fluid as fluid
import contextlib
paddle.enable_static()
def get_places():
places = [fluid.CPUPlace()]
......
......@@ -62,6 +62,8 @@ def run_check():
# Your Paddle Fluid works well on MUTIPLE GPU or CPU.
# Your Paddle Fluid is installed successfully! Let's start deep Learning with Paddle Fluid now
"""
paddle.enable_static()
print("Running Verify Fluid Program ... ")
device_list = []
......@@ -157,3 +159,5 @@ def run_check():
print(
"Your Paddle Fluid is installed successfully ONLY for SINGLE GPU or CPU! "
"\n Let's start deep Learning with Paddle Fluid now")
paddle.disable_static()
......@@ -23,6 +23,8 @@ import math
import sys
import os
paddle.enable_static()
def train(use_cuda, save_dirname, is_local):
x = fluid.layers.data(name='x', shape=[13], dtype='float32')
......
......@@ -24,6 +24,8 @@ import unittest
import os
import numpy as np
paddle.enable_static()
def resnet_cifar10(input, depth=32):
def conv_bn_layer(input,
......
......@@ -25,6 +25,8 @@ import paddle
import paddle.dataset.conll05 as conll05
import paddle.fluid as fluid
paddle.enable_static()
word_dict, verb_dict, label_dict = conll05.get_dict()
word_dict_len = len(word_dict)
label_dict_len = len(label_dict)
......
......@@ -24,6 +24,8 @@ from paddle.fluid.executor import Executor
import unittest
import os
paddle.enable_static()
dict_size = 30000
source_dict_dim = target_dict_dim = dict_size
hidden_dim = 32
......
......@@ -26,6 +26,8 @@ import paddle
import paddle.fluid as fluid
from paddle.fluid.layers.device import get_places
paddle.enable_static()
BATCH_SIZE = 64
......
......@@ -26,6 +26,8 @@ import paddle.fluid.nets as nets
from paddle.fluid.executor import Executor
from paddle.fluid.optimizer import SGDOptimizer
paddle.enable_static()
IS_SPARSE = True
USE_GPU = False
BATCH_SIZE = 256
......
......@@ -25,6 +25,9 @@ import math
import sys
import unittest
from paddle.fluid.executor import Executor
import paddle
paddle.enable_static()
dict_size = 30000
source_dict_dim = target_dict_dim = dict_size
......
......@@ -23,6 +23,8 @@ import numpy as np
import math
import sys
paddle.enable_static()
def train(use_cuda, is_sparse, is_parallel, save_dirname, is_local=True):
PASS_NUM = 100
......
......@@ -21,6 +21,8 @@ import contextlib
import paddle
import paddle.fluid as fluid
paddle.enable_static()
file_dir = os.path.dirname(os.path.abspath(__file__))
fluid.load_op_library(os.path.join(file_dir, 'librelu2_op.so'))
......
......@@ -29,6 +29,8 @@ from paddle.fluid.contrib.decoder.beam_search_decoder import *
import unittest
import os
paddle.enable_static()
dict_size = 30000
source_dict_dim = target_dict_dim = dict_size
src_dict, trg_dict = paddle.dataset.wmt14.get_dict(dict_size)
......
......@@ -16,6 +16,9 @@ from __future__ import print_function
import paddle.fluid as fluid
import unittest
import paddle
paddle.enable_static()
class TestDataFeeder(unittest.TestCase):
......
......@@ -24,6 +24,9 @@ import numpy as np
from unittests.test_imperative_base import new_program_scope
from paddle.fluid.dygraph import base
from paddle.fluid import core
import paddle
paddle.enable_static()
class LayerTest(unittest.TestCase):
......
......@@ -22,6 +22,7 @@ BATCH_SIZE = 128
CLIP_MAX = 2e-6
CLIP_MIN = -1e-6
paddle.enable_static()
prog = fluid.framework.Program()
with fluid.program_guard(main_program=prog):
......
......@@ -28,6 +28,8 @@ from paddle.fluid.layers.control_flow import ConditionalBlock
import unittest
import numpy as np
paddle.enable_static()
class TestMNISTIfElseOp(unittest.TestCase):
# FIXME: https://github.com/PaddlePaddle/Paddle/issues/12245#issuecomment-406462379
......
......@@ -21,6 +21,9 @@ import numpy as np
import paddle.fluid.layers as layers
import paddle.fluid.framework as framework
import paddle.fluid as fluid
import paddle
paddle.enable_static()
class TestPythonOperatorOverride(unittest.TestCase):
......
......@@ -19,6 +19,9 @@ import os
import paddle.fluid.core as core
import paddle.fluid as fluid
from paddle.distributed.fleet.base.private_helper_function import wait_server_ready
import paddle
paddle.enable_static()
class TestCCommInitOp(unittest.TestCase):
......
......@@ -28,6 +28,8 @@ import paddle
import paddle.fluid as fluid
import paddle.compat as cpt
paddle.enable_static()
np.random.seed(0)
......
......@@ -35,6 +35,8 @@ import paddle.fluid.layers as layers
from functools import reduce
from test_collective_api_base import TestCollectiveAPIRunnerBase, runtime_main
paddle.enable_static()
class TestCollectiveAllgatherAPI(TestCollectiveAPIRunnerBase):
def __init__(self):
......
......@@ -34,6 +34,8 @@ import paddle.fluid.layers as layers
from functools import reduce
from test_collective_base import TestCollectiveRunnerBase, runtime_main
paddle.enable_static()
class TestCollectiveAllGather(TestCollectiveRunnerBase):
def __init__(self):
......
......@@ -35,6 +35,8 @@ import paddle.fluid.layers as layers
from functools import reduce
from test_collective_api_base import TestCollectiveAPIRunnerBase, runtime_main
paddle.enable_static()
class TestCollectiveAllreduceAPI(TestCollectiveAPIRunnerBase):
def __init__(self):
......
......@@ -35,6 +35,8 @@ import paddle.fluid.layers as layers
from functools import reduce
from test_collective_base import TestCollectiveRunnerBase, runtime_main
paddle.enable_static()
class TestCollectiveAllreduce(TestCollectiveRunnerBase):
def __init__(self):
......
......@@ -35,6 +35,8 @@ import paddle.fluid.layers as layers
from functools import reduce
from test_collective_api_base import TestCollectiveAPIRunnerBase, runtime_main
paddle.enable_static()
class TestCollectiveBarrierAPI(TestCollectiveAPIRunnerBase):
def __init__(self):
......
......@@ -35,6 +35,8 @@ import paddle.fluid.layers as layers
from functools import reduce
from test_collective_api_base import TestCollectiveAPIRunnerBase, runtime_main
paddle.enable_static()
class TestCollectiveBroadcastAPI(TestCollectiveAPIRunnerBase):
def __init__(self):
......
......@@ -35,6 +35,8 @@ import paddle.fluid.layers as layers
from functools import reduce
from test_collective_base import TestCollectiveRunnerBase, runtime_main
paddle.enable_static()
class TestCollectiveBroadcast(TestCollectiveRunnerBase):
def __init__(self):
......
......@@ -35,6 +35,8 @@ import paddle.fluid.layers as layers
from functools import reduce
from test_collective_api_base import TestCollectiveAPIRunnerBase, runtime_main
paddle.enable_static()
class TestCollectiveReduceAPI(TestCollectiveAPIRunnerBase):
def __init__(self):
......
......@@ -35,6 +35,8 @@ import paddle.fluid.layers as layers
from functools import reduce
from test_collective_base import TestCollectiveRunnerBase, runtime_main
paddle.enable_static()
class TestCollectiveReduce(TestCollectiveRunnerBase):
def __init__(self):
......
......@@ -35,6 +35,8 @@ import paddle.fluid.layers as layers
from functools import reduce
from test_collective_base import TestCollectiveRunnerBase, runtime_main
paddle.enable_static()
class TestCollectiveReduce(TestCollectiveRunnerBase):
def __init__(self):
......
......@@ -34,6 +34,8 @@ import paddle.fluid.layers as layers
from functools import reduce
from test_collective_base import TestCollectiveRunnerBase, runtime_main
paddle.enable_static()
class TestCollectiveReduceScatter(TestCollectiveRunnerBase):
def __init__(self):
......
......@@ -35,6 +35,8 @@ import paddle.fluid.layers as layers
from functools import reduce
from test_collective_base import TestCollectiveRunnerBase, runtime_main
paddle.enable_static()
class TestCollectiveReduceScatter(TestCollectiveRunnerBase):
def __init__(self):
......
......@@ -35,6 +35,8 @@ import paddle.fluid.layers as layers
from functools import reduce
from test_collective_api_base import TestCollectiveAPIRunnerBase, runtime_main
paddle.enable_static()
class TestCollectiveScatterAPI(TestCollectiveAPIRunnerBase):
def __init__(self):
......
......@@ -35,6 +35,8 @@ import paddle.fluid.layers as layers
from functools import reduce
from test_collective_base import TestCollectiveRunnerBase, runtime_main
paddle.enable_static()
class TestCollectiveScatter(TestCollectiveRunnerBase):
def __init__(self):
......
......@@ -30,6 +30,8 @@ import signal
from functools import reduce
from test_dist_base import TestDistRunnerBase, runtime_main
paddle.enable_static()
DTYPE = "float32"
paddle.dataset.mnist.fetch()
......
......@@ -30,6 +30,8 @@ import ctr_dataset_reader
from test_dist_fleet_base import runtime_main, FleetDistRunnerBase
from paddle.distributed.fleet.base.util_factory import fleet_util
paddle.enable_static()
# Fix seed for test
fluid.default_startup_program().random_seed = 1
fluid.default_main_program().random_seed = 1
......
......@@ -31,6 +31,8 @@ from test_dist_fleet_heter_base import runtime_main, FleetDistHeterRunnerBase
from dist_fleet_ctr import TestDistCTR2x2, fake_ctr_reader
from paddle.distributed.fleet.base.util_factory import fleet_util
paddle.enable_static()
# Fix seed for test
fluid.default_startup_program().random_seed = 1
fluid.default_main_program().random_seed = 1
......
......@@ -34,6 +34,8 @@ from functools import reduce
from test_dist_fleet_base import runtime_main, FleetDistRunnerBase
from paddle.distributed.fleet.base.util_factory import fleet_util
paddle.enable_static()
DTYPE = "int64"
DATA_URL = 'http://paddle-dist-ce-data.bj.bcebos.com/simnet.train.1000'
DATA_MD5 = '24e49366eb0611c552667989de2f57d5'
......
......@@ -31,6 +31,8 @@ from functools import reduce
from test_dist_base import TestDistRunnerBase, runtime_main
from paddle.fluid.incubate.fleet.collective import fleet, DistributedStrategy
paddle.enable_static()
DTYPE = "float32"
paddle.dataset.mnist.fetch()
......
......@@ -30,6 +30,8 @@ import sys
import signal
from test_dist_base import TestDistRunnerBase, runtime_main
paddle.enable_static()
# Fix seed for test
fluid.default_startup_program().random_seed = 1
fluid.default_main_program().random_seed = 1
......
......@@ -17,12 +17,14 @@ import random
import time
import unittest
import paddle
import paddle.fluid as fluid
from paddle.fluid.dygraph import ProgramTranslator
from paddle.fluid.dygraph import to_variable
from yolov3 import cfg, YOLOv3
paddle.enable_static()
random.seed(0)
np.random.seed(0)
......
......@@ -15,9 +15,12 @@
from __future__ import print_function
import unittest
import numpy as np
import paddle
from test_collective_base import TestDistBase
paddle.enable_static()
class TestAllGatherOp(TestDistBase):
def _setup_config(self):
......
......@@ -15,9 +15,12 @@
from __future__ import print_function
import unittest
import numpy as np
import paddle
from test_collective_base import TestDistBase
paddle.enable_static()
class TestAllReduceOp(TestDistBase):
def _setup_config(self):
......
......@@ -31,6 +31,7 @@ from paddle.io import Dataset, BatchSampler, DataLoader
from paddle.fluid.tests.unittests.auto_checkpoint_utils import AutoCheckpointBase, get_logger
paddle.enable_static()
logger = get_logger()
......
......@@ -32,6 +32,7 @@ from paddle.io import Dataset, BatchSampler, DataLoader
from paddle.fluid.tests.unittests.auto_checkpoint_utils import AutoCheckpointBase, get_logger
from paddle.fluid.tests.unittests.test_auto_checkpoint import AutoCheckPointACLBase
paddle.enable_static()
logger = get_logger()
......
......@@ -32,6 +32,7 @@ from paddle.io import Dataset, BatchSampler, DataLoader
from paddle.fluid.tests.unittests.auto_checkpoint_utils import AutoCheckpointBase, get_logger
from paddle.fluid.tests.unittests.test_auto_checkpoint import AutoCheckPointACLBase
paddle.enable_static()
logger = get_logger()
......
......@@ -32,6 +32,7 @@ from paddle.io import Dataset, BatchSampler, DataLoader
from paddle.fluid.tests.unittests.auto_checkpoint_utils import AutoCheckpointBase, get_logger
from paddle.fluid.tests.unittests.test_auto_checkpoint import AutoCheckPointACLBase
paddle.enable_static()
logger = get_logger()
......
......@@ -32,6 +32,7 @@ from paddle.io import Dataset, BatchSampler, DataLoader
from paddle.fluid.tests.unittests.auto_checkpoint_utils import AutoCheckpointBase, get_logger
from paddle.fluid.tests.unittests.test_auto_checkpoint import AutoCheckPointACLBase
paddle.enable_static()
logger = get_logger()
......
......@@ -32,6 +32,7 @@ from paddle.io import Dataset, BatchSampler, DataLoader
from paddle.fluid.tests.unittests.auto_checkpoint_utils import AutoCheckpointBase, get_logger
from paddle.fluid.tests.unittests.test_auto_checkpoint import AutoCheckPointACLBase
paddle.enable_static()
logger = get_logger()
......
......@@ -15,9 +15,12 @@
from __future__ import print_function
import unittest
import numpy as np
import paddle
from test_collective_base import TestDistBase
paddle.enable_static()
class TestCBroadcastOp(TestDistBase):
def _setup_config(self):
......
......@@ -36,6 +36,7 @@ class InplaceTestBase(unittest.TestCase):
self.fuse_all_optimizer_ops = False
def setUp(self):
paddle.enable_static()
self.initParameter()
if self.use_cuda and fluid.core.is_compiled_with_cuda():
self.device_count = fluid.core.get_cuda_device_count()
......
......@@ -15,9 +15,12 @@
from __future__ import print_function
import unittest
import numpy as np
import paddle
from test_collective_api_base import TestDistBase
paddle.enable_static()
class TestCollectiveAllgatherAPI(TestDistBase):
def _setup_config(self):
......
......@@ -15,9 +15,12 @@
from __future__ import print_function
import unittest
import numpy as np
import paddle
from test_collective_api_base import TestDistBase
paddle.enable_static()
class TestCollectiveAllreduceAPI(TestDistBase):
def _setup_config(self):
......
......@@ -15,9 +15,12 @@
from __future__ import print_function
import unittest
import numpy as np
import paddle
from test_collective_api_base import TestDistBase
paddle.enable_static()
class TestCollectiveBarrierAPI(TestDistBase):
def _setup_config(self):
......
......@@ -15,9 +15,12 @@
from __future__ import print_function
import unittest
import numpy as np
import paddle
from test_collective_api_base import TestDistBase
paddle.enable_static()
class TestCollectiveBroadcastAPI(TestDistBase):
def _setup_config(self):
......
......@@ -15,9 +15,12 @@
from __future__ import print_function
import unittest
import numpy as np
import paddle
from test_collective_base import TestDistBase
paddle.enable_static()
class TestCReduceOp(TestDistBase):
def _setup_config(self):
......
......@@ -15,9 +15,12 @@
from __future__ import print_function
import unittest
import numpy as np
import paddle
from test_collective_api_base import TestDistBase
paddle.enable_static()
class TestCollectiveReduceAPI(TestDistBase):
def _setup_config(self):
......
......@@ -15,9 +15,12 @@
from __future__ import print_function
import unittest
import numpy as np
import paddle
from test_collective_base import TestDistBase
paddle.enable_static()
class TestCScatterOp(TestDistBase):
def _setup_config(self):
......
......@@ -15,9 +15,12 @@
from __future__ import print_function
import unittest
import numpy as np
import paddle
from test_collective_api_base import TestDistBase
paddle.enable_static()
class TestCollectiveScatterAPI(TestDistBase):
def _setup_config(self):
......
......@@ -28,6 +28,8 @@ import paddle.fluid as fluid
import paddle.distributed.fleet.base.role_maker as role_maker
import paddle.distributed.fleet as fleet
paddle.enable_static()
class TestCommunicatorGeoEnd2End(unittest.TestCase):
def net(self):
......@@ -140,6 +142,7 @@ import paddle.distributed.fleet as fleet
from test_communicator_geo import TestCommunicatorGeoEnd2End
paddle.enable_static()
class RunServer(TestCommunicatorGeoEnd2End):
def runTest(self):
......
......@@ -29,6 +29,8 @@ import paddle.fluid.incubate.fleet.base.role_maker as role_maker
from paddle.fluid.incubate.fleet.parameter_server.distribute_transpiler import fleet
from paddle.fluid.incubate.fleet.parameter_server.distribute_transpiler.distributed_strategy import StrategyFactory
paddle.enable_static()
class TestCommunicatorHalfAsyncEnd2End(unittest.TestCase):
def net(self):
......@@ -120,6 +122,7 @@ from test_communicator_half_async import TestCommunicatorHalfAsyncEnd2End
from paddle.fluid.incubate.fleet.parameter_server.distribute_transpiler import fleet
from paddle.fluid.incubate.fleet.parameter_server.distribute_transpiler.distributed_strategy import StrategyFactory
paddle.enable_static()
class RunServer(TestCommunicatorHalfAsyncEnd2End):
def runTest(self):
......
......@@ -15,6 +15,9 @@
from __future__ import print_function
import unittest
from test_dist_base import TestDistBase
import paddle
paddle.enable_static()
class TestDistMnistNCCL2(TestDistBase):
......
......@@ -19,6 +19,8 @@ import unittest
import paddle
import paddle.distributed.fleet.base.role_maker as role_maker
paddle.enable_static()
class TestFleetGradientMergeMetaOptimizer(unittest.TestCase):
def setUp(self):
......
......@@ -18,6 +18,8 @@ import os
import paddle.distributed.fleet.base.role_maker as role_maker
import time
paddle.enable_static()
class TestFleetGradientMergeMetaOptimizer(unittest.TestCase):
def setUp(self):
......
......@@ -18,6 +18,8 @@ import os
import paddle.distributed.fleet.base.role_maker as role_maker
import time
paddle.enable_static()
class TestFleetGradientMergeMetaOptimizer(unittest.TestCase):
def setUp(self):
......
......@@ -18,6 +18,8 @@ import os
import paddle.distributed.fleet.base.role_maker as role_maker
import time
paddle.enable_static()
class TestFleetGradientMergeMetaOptimizer(unittest.TestCase):
def setUp(self):
......
......@@ -18,6 +18,8 @@ import os
import paddle.distributed.fleet.base.role_maker as role_maker
import time
paddle.enable_static()
class TestFleetGradientMergeMetaOptimizer(unittest.TestCase):
def setUp(self):
......
......@@ -19,6 +19,8 @@ import paddle.distributed.fleet as fleet
import paddle.distributed.fleet.base.role_maker as role_maker
import time
paddle.enable_static()
class TestFleetGradientMergeMetaOptimizer(unittest.TestCase):
def setUp(self):
......
......@@ -22,6 +22,9 @@ from paddle.fluid.incubate.fleet.parameter_server.distribute_transpiler import f
from paddle.fluid.incubate.fleet.parameter_server.distribute_transpiler.distributed_strategy import StrategyFactory
from test_dist_fleet_base import TestFleetBase
from dist_fleet_simnet_bow import train_network
import paddle
paddle.enable_static()
class TestDistGeoCtr_2x2(TestFleetBase):
......
......@@ -18,6 +18,9 @@ import os
import unittest
import tempfile
from test_dist_fleet_heter_base import TestFleetHeterBase
import paddle
paddle.enable_static()
class TestDistHeterDatasetAsync2x2(TestFleetHeterBase):
......
......@@ -21,6 +21,9 @@ import paddle.fluid as fluid
import paddle.distributed.fleet.base.role_maker as role_maker
from paddle.distributed.fleet.base.util_factory import fleet_util
from paddle.distributed.fleet import fleet
import paddle
paddle.enable_static()
class TestDistFleetHeterProgram(unittest.TestCase):
......
......@@ -19,6 +19,9 @@ import paddle.fluid as fluid
import paddle.fluid.incubate.fleet.base.role_maker as role_maker
from paddle.fluid.incubate.fleet.parameter_server.distribute_transpiler import fleet
from paddle.fluid.incubate.fleet.parameter_server.distribute_transpiler.distributed_strategy import StrategyFactory
import paddle
paddle.enable_static()
# For Net
base_lr = 0.2
......
......@@ -24,6 +24,8 @@ import paddle.fluid as fluid
import paddle.distributed.fleet.base.role_maker as role_maker
import paddle.distributed.fleet as fleet
paddle.enable_static()
# For Net
base_lr = 0.2
emb_lr = base_lr * 3
......
......@@ -19,6 +19,9 @@ import paddle.fluid as fluid
import paddle.fluid.incubate.fleet.base.role_maker as role_maker
from paddle.fluid.incubate.fleet.parameter_server.distribute_transpiler import fleet
from paddle.fluid.incubate.fleet.parameter_server.distribute_transpiler.distributed_strategy import StrategyFactory
import paddle
paddle.enable_static()
# For Net
base_lr = 0.2
......
......@@ -19,6 +19,9 @@ import paddle.fluid as fluid
import paddle.fluid.incubate.fleet.base.role_maker as role_maker
from paddle.fluid.incubate.fleet.parameter_server.distribute_transpiler import fleet
from paddle.fluid.incubate.fleet.parameter_server.distribute_transpiler.distributed_strategy import StrategyFactory
import paddle
paddle.enable_static()
# For Net
base_lr = 0.2
......
......@@ -19,6 +19,9 @@ import paddle.fluid as fluid
import paddle.fluid.incubate.fleet.base.role_maker as role_maker
from paddle.fluid.incubate.fleet.parameter_server.distribute_transpiler import fleet
from paddle.fluid.incubate.fleet.parameter_server.distribute_transpiler.distributed_strategy import StrategyFactory
import paddle
paddle.enable_static()
# For Net
base_lr = 0.2
......
......@@ -18,6 +18,9 @@ import os
import unittest
import tempfile
from test_dist_fleet_base import TestFleetBase
import paddle
paddle.enable_static()
class TestDistSimnetASync2x2(TestFleetBase):
......
......@@ -15,6 +15,9 @@
from __future__ import print_function
import unittest
from test_dist_base import TestDistBase
import paddle
paddle.enable_static()
class TestDistMnistNCCL2BackWardDeps(TestDistBase):
......
......@@ -16,6 +16,9 @@ from __future__ import print_function
import unittest
from test_dist_base import TestDistBase
import os
import paddle
paddle.enable_static()
flag_name = os.path.splitext(__file__)[0]
......
......@@ -18,6 +18,9 @@ from test_dist_base import TestDistBase
import os
import subprocess
import paddle
paddle.enable_static()
flag_name = os.path.splitext(__file__)[0]
......
......@@ -17,6 +17,9 @@ import shutil
import os
import unittest
from test_dist_base import TestDistBase
import paddle
paddle.enable_static()
class TestDistMnistFleetSave(TestDistBase):
......
......@@ -15,6 +15,9 @@
from __future__ import print_function
import unittest
from test_dist_base import TestDistBase
import paddle
paddle.enable_static()
class TestDistMnistNCCL2FleetApi(TestDistBase):
......
......@@ -17,6 +17,9 @@ import unittest
from test_dist_base import TestDistBase
import os
import paddle
paddle.enable_static()
flag_name = os.path.splitext(__file__)[0]
......
......@@ -17,6 +17,9 @@ import unittest
from test_dist_base import TestDistBase
import os
import paddle
paddle.enable_static()
flag_name = os.path.splitext(__file__)[0]
......
......@@ -15,6 +15,9 @@
from __future__ import print_function
import unittest
from test_dist_base import TestDistBase
import paddle
paddle.enable_static()
class TestDistMnistNCCL2(TestDistBase):
......
......@@ -15,6 +15,9 @@
from __future__ import print_function
import unittest
from test_dist_base import TestDistBase
import paddle
paddle.enable_static()
class TestDistMnistNCCL2(TestDistBase):
......
......@@ -15,6 +15,9 @@
from __future__ import print_function
import unittest
from test_dist_base import TestDistBase
import paddle
paddle.enable_static()
class TestDistMnistLocalSGDFleetApi(TestDistBase):
......
......@@ -19,6 +19,8 @@ import paddle
import paddle.fluid as fluid
import paddle.fluid.core as core
paddle.enable_static()
def dist(x, y, p):
if p == 0.:
......
......@@ -18,6 +18,9 @@ from test_dist_base import TestDistBase
import os
import os
import paddle
paddle.enable_static()
flag_name = os.path.splitext(__file__)[0]
......
......@@ -17,6 +17,9 @@ from __future__ import print_function
import unittest
import gc
import paddle.fluid as fluid
import paddle
paddle.enable_static()
class TranspilerAsyncLRDecayTest(unittest.TestCase):
......
......@@ -15,6 +15,9 @@
import unittest
import paddle.fluid as fluid
import gc
import paddle
paddle.enable_static()
gc.set_debug(gc.DEBUG_COLLECTABLE)
......
......@@ -17,6 +17,8 @@ import paddle
import os
from launch_function_helper import launch_func, wait, _find_free_port
paddle.enable_static()
class TestFleetGraphExecutionMetaOptimizer(unittest.TestCase):
def setUp(self):
......
......@@ -28,6 +28,8 @@ import unittest
from multiprocessing import Process
from op_test import OpTest
paddle.enable_static()
def run_pserver(use_cuda, sync_mode, ip, port, trainers, trainer_id):
remove_ps_flag(os.getpid())
......
......@@ -19,6 +19,9 @@ import unittest
import os
import sys
import subprocess
import paddle
paddle.enable_static()
class TestNanInf(unittest.TestCase):
......
......@@ -15,9 +15,12 @@
from __future__ import print_function
import unittest
import numpy as np
import paddle
from test_collective_base import TestDistBase
paddle.enable_static()
class TestReduceScatterOp(TestDistBase):
def _setup_config(self):
......
......@@ -16,9 +16,12 @@ from __future__ import print_function
import unittest
import numpy as np
import paddle.fluid as fluid
import paddle
from test_collective_base import TestDistBase
paddle.enable_static()
class TestReduceScatterAPI(TestDistBase):
def _setup_config(self):
......
......@@ -28,6 +28,8 @@ from paddle import Model, set_device
from paddle.static import InputSpec as Input
from paddle.text import *
paddle.enable_static()
class ModuleApiTest(unittest.TestCase):
@classmethod
......
......@@ -17,12 +17,14 @@ from __future__ import print_function
import unittest
import os
import sys
import paddle
import paddle.fluid as fluid
import importlib
from six.moves import cStringIO
def main():
paddle.enable_static()
sys.path.append(os.getcwd())
some_test_failed = False
for module_name in sys.argv[1:]:
......@@ -44,6 +46,7 @@ def main():
'failed\n',
buffer.getvalue(),
file=sys.stderr)
paddle.disable_static()
if some_test_failed:
exit(1)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册