提交 93bf920e 编写于 作者: W wuzewu

add Task run environment

上级 28eb496f
......@@ -142,7 +142,11 @@ def from_module_attr_to_param(module_attr):
return param
def connect_program(pre_program, next_program, input_dict=None, inplace=True):
def connect_program(pre_program,
next_program,
input_dict=None,
inplace=True,
need_log=True):
def _copy_vars_and_ops_in_blocks(from_block, to_block):
for var in from_block.vars:
var = from_block.var(var)
......@@ -198,7 +202,8 @@ def connect_program(pre_program, next_program, input_dict=None, inplace=True):
outputs={'Out': output_var})
block_map = {0: 0}
logger.info("Connect program's input tensor")
if need_log:
logger.info("Connect program's input tensor")
for index, block in enumerate(next_program.blocks):
if block.idx == 0:
_copy_vars_and_ops_in_blocks(block, output_program.global_block())
......@@ -210,7 +215,8 @@ def connect_program(pre_program, next_program, input_dict=None, inplace=True):
new_block = output_program._create_block(
parent_idx=block_map[block.parent_idx])
_copy_vars_and_ops_in_blocks(block, new_block)
logger.info("Connect program's input tensor done")
if need_log:
logger.info("Connect program's input tensor done")
return output_program
......
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册