Skip to content

Commit b2a6586

Browse files
authored
not enable syncbn in cpu (PaddlePaddle#2711)
1 parent 4fa3046 commit b2a6586

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

PaddleCV/PaddleDetection/tools/train.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,9 @@ def main():
126126
build_strategy.memory_optimize = False
127127
build_strategy.enable_inplace = True
128128
sync_bn = getattr(model.backbone, 'norm_type', None) == 'sync_bn'
129-
# only enable sync_bn in multi-devices
130-
build_strategy.sync_batch_norm = sync_bn and devices_num > 1
129+
# only enable sync_bn in multi GPU devices
130+
build_strategy.sync_batch_norm = sync_bn and devices_num > 1 \
131+
and cfg.use_gpu
131132
train_compile_program = fluid.compiler.CompiledProgram(
132133
train_prog).with_data_parallel(
133134
loss_name=loss.name, build_strategy=build_strategy)

0 commit comments

Comments
 (0)