提交 5c91b973 编写于 作者: J jingqinghe

set default value to strategy in distributed_optimizer test=develop

上级 50a5bcfc
...@@ -16,6 +16,7 @@ from __future__ import print_function ...@@ -16,6 +16,7 @@ from __future__ import print_function
import paddle import paddle
from .strategy_compiler import StrategyCompiler from .strategy_compiler import StrategyCompiler
from .meta_optimizer_factory import MetaOptimizerFactory from .meta_optimizer_factory import MetaOptimizerFactory
from .distributed_strategy import DistributedStrategy
from .runtime_factory import RuntimeFactory from .runtime_factory import RuntimeFactory
from .util_factory import UtilFactory from .util_factory import UtilFactory
...@@ -209,7 +210,7 @@ class Fleet(object): ...@@ -209,7 +210,7 @@ class Fleet(object):
assert self._runtime_handle is not None assert self._runtime_handle is not None
self._runtime_handle._stop_worker() self._runtime_handle._stop_worker()
def distributed_optimizer(self, optimizer, strategy): def distributed_optimizer(self, optimizer, strategy=None):
""" """
distirbuted_optimizer distirbuted_optimizer
Returns: Returns:
...@@ -225,6 +226,8 @@ class Fleet(object): ...@@ -225,6 +226,8 @@ class Fleet(object):
optimizer = fleet.distributed_optimizer(optimizer, strategy=strategy) optimizer = fleet.distributed_optimizer(optimizer, strategy=strategy)
""" """
self.user_defined_optimizer = optimizer self.user_defined_optimizer = optimizer
if strategy == None:
strategy = DistributedStrategy()
self.user_defined_strategy = strategy self.user_defined_strategy = strategy
self.valid_strategy = None self.valid_strategy = None
return self return self
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册