未验证 提交 0dfb5c94 编写于 作者: L lilong12 提交者: GitHub

construct a DistributedStrategy instance if the passed one is None (#21545) (#21567)

上级 2afe928a
......@@ -151,8 +151,10 @@ class CollectiveOptimizer(DistributedOptimizer):
"""
def __init__(self, optimizer, strategy=DistributedStrategy()):
if strategy is None:
strategy = DistributedStrategy()
super(CollectiveOptimizer, self).__init__(optimizer, strategy)
if strategy is not None and strategy.forward_recompute:
if strategy.forward_recompute:
self.forward_recompute = True
self.recompute_checkpoints = strategy.recompute_checkpoints
else:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册