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

not enable syncbn in cpu (#2711)

上级 96757d80
......@@ -126,8 +126,9 @@ def main():
build_strategy.memory_optimize = False
build_strategy.enable_inplace = True
sync_bn = getattr(model.backbone, 'norm_type', None) == 'sync_bn'
# only enable sync_bn in multi-devices
build_strategy.sync_batch_norm = sync_bn and devices_num > 1
# only enable sync_bn in multi GPU devices
build_strategy.sync_batch_norm = sync_bn and devices_num > 1 \
and cfg.use_gpu
train_compile_program = fluid.compiler.CompiledProgram(
train_prog).with_data_parallel(
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.
先完成此消息的编辑!
想要评论请 注册