From dd39d1fd97920431ace24b99542daa2ac4a84981 Mon Sep 17 00:00:00 2001 From: "shaohua.zhang" Date: Thu, 27 Aug 2020 14:37:35 +0800 Subject: [PATCH] Update utility.py --- ppocr/utils/utility.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/ppocr/utils/utility.py b/ppocr/utils/utility.py index 2cf3c8f5..e27dd1d8 100755 --- a/ppocr/utils/utility.py +++ b/ppocr/utils/utility.py @@ -90,3 +90,15 @@ def check_and_read_gif(img_path): return imgvalue, True return None, False + +def create_multi_devices_program(program, loss_var_name): + build_strategy = fluid.BuildStrategy() + build_strategy.memory_optimize = False + build_strategy.enable_inplace = True + exec_strategy = fluid.ExecutionStrategy() + exec_strategy.num_iteration_per_drop_scope = 1 + compile_program = fluid.CompiledProgram(program).with_data_parallel( + loss_name=loss_var_name, + build_strategy=build_strategy, + exec_strategy=exec_strategy) + return compile_program -- GitLab