Skip to content

Commit

Permalink
fix sync_bn in cpu (PaddlePaddle#2825)
Browse files Browse the repository at this point in the history
* fix sync_bn in cpu
  • Loading branch information
yghstill authored Apr 29, 2021
1 parent a73970b commit 03f79b0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tools/eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ def main():

place = paddle.set_device('gpu' if cfg.use_gpu else 'cpu')

if 'norm_type' in cfg and cfg['norm_type'] == 'sync_bn' and not cfg.use_gpu:
cfg['norm_type'] = 'bn'

if FLAGS.slim_config:
cfg = build_slim_model(cfg, FLAGS.slim_config, mode='eval')

Expand Down
3 changes: 3 additions & 0 deletions tools/infer.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ def main():

place = paddle.set_device('gpu' if cfg.use_gpu else 'cpu')

if 'norm_type' in cfg and cfg['norm_type'] == 'sync_bn' and not cfg.use_gpu:
cfg['norm_type'] = 'bn'

if FLAGS.slim_config:
cfg = build_slim_model(cfg, FLAGS.slim_config, mode='test')

Expand Down
3 changes: 3 additions & 0 deletions tools/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@ def main():

place = paddle.set_device('gpu' if cfg.use_gpu else 'cpu')

if 'norm_type' in cfg and cfg['norm_type'] == 'sync_bn' and not cfg.use_gpu:
cfg['norm_type'] = 'bn'

if FLAGS.slim_config:
cfg = build_slim_model(cfg, FLAGS.slim_config)

Expand Down

0 comments on commit 03f79b0

Please sign in to comment.