Skip to content

Commit 0dfb5c9

Browse files
author
lilong12
authored
construct a DistributedStrategy instance if the passed one is None (#21545) (#21567)
1 parent 2afe928 commit 0dfb5c9

File tree

1 file changed

+3
-1
lines changed
  • python/paddle/fluid/incubate/fleet/collective

1 file changed

+3
-1
lines changed

python/paddle/fluid/incubate/fleet/collective/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,10 @@ class CollectiveOptimizer(DistributedOptimizer):
151151
"""
152152

153153
def __init__(self, optimizer, strategy=DistributedStrategy()):
154+
if strategy is None:
155+
strategy = DistributedStrategy()
154156
super(CollectiveOptimizer, self).__init__(optimizer, strategy)
155-
if strategy is not None and strategy.forward_recompute:
157+
if strategy.forward_recompute:
156158
self.forward_recompute = True
157159
self.recompute_checkpoints = strategy.recompute_checkpoints
158160
else:

0 commit comments

Comments
 (0)