未验证 提交 03f79b00 编写于 作者: G Guanghua Yu 提交者: GitHub

fix sync_bn in cpu (#2825)

* fix sync_bn in cpu
上级 a73970b0
...@@ -117,6 +117,9 @@ def main(): ...@@ -117,6 +117,9 @@ def main():
place = paddle.set_device('gpu' if cfg.use_gpu else 'cpu') 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: if FLAGS.slim_config:
cfg = build_slim_model(cfg, FLAGS.slim_config, mode='eval') cfg = build_slim_model(cfg, FLAGS.slim_config, mode='eval')
......
...@@ -141,6 +141,9 @@ def main(): ...@@ -141,6 +141,9 @@ def main():
place = paddle.set_device('gpu' if cfg.use_gpu else 'cpu') 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: if FLAGS.slim_config:
cfg = build_slim_model(cfg, FLAGS.slim_config, mode='test') cfg = build_slim_model(cfg, FLAGS.slim_config, mode='test')
......
...@@ -123,6 +123,9 @@ def main(): ...@@ -123,6 +123,9 @@ def main():
place = paddle.set_device('gpu' if cfg.use_gpu else 'cpu') 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: if FLAGS.slim_config:
cfg = build_slim_model(cfg, FLAGS.slim_config) cfg = build_slim_model(cfg, FLAGS.slim_config)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册