提交 da75ac8b 编写于 作者: L lilong12 提交者: gongweibao

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

上级 de46b159
......@@ -191,8 +191,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.
先完成此消息的编辑!
想要评论请 注册