提交 5ad237b6 编写于 作者: K Kaipeng Deng 提交者: GitHub

not enable sync bn in single device (#2607)

上级 3e57b4c3
...@@ -126,7 +126,8 @@ def main(): ...@@ -126,7 +126,8 @@ def main():
build_strategy.memory_optimize = False build_strategy.memory_optimize = False
build_strategy.enable_inplace = True build_strategy.enable_inplace = True
sync_bn = getattr(model.backbone, 'norm_type', None) == 'sync_bn' sync_bn = getattr(model.backbone, 'norm_type', None) == 'sync_bn'
build_strategy.sync_batch_norm = sync_bn # only enable sync_bn in multi-devices
build_strategy.sync_batch_norm = sync_bn and devices_num > 1
train_compile_program = fluid.compiler.CompiledProgram( train_compile_program = fluid.compiler.CompiledProgram(
train_prog).with_data_parallel( train_prog).with_data_parallel(
loss_name=loss.name, build_strategy=build_strategy) loss_name=loss.name, build_strategy=build_strategy)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册