未验证 提交 2cb5c355 编写于 作者: Q Qiao Longfei 提交者: GitHub

Merge pull request #12129 from jacquesqiao/clean-code

simpilify distribute transpiler
...@@ -1284,20 +1284,8 @@ class DistributeTranspiler(object): ...@@ -1284,20 +1284,8 @@ class DistributeTranspiler(object):
# If one op's input is another op's output or # If one op's input is another op's output or
# one op's output is another op's input, we say # one op's output is another op's input, we say
# the two operator is connected. # the two operator is connected.
def _append_inname(varname_list): if set(op1.desc.output_arg_names()) & set(op2.desc.input_arg_names()) or \
op_input_names = [] set(op1.desc.input_arg_names()) & set(op2.desc.output_arg_names()):
for in_name in varname_list:
op_input_names.append(in_name)
return op_input_names
op1_input_names = _append_inname(op1.desc.input_arg_names())
op1_output_names = op1.desc.output_arg_names()
op2_input_names = _append_inname(op2.desc.input_arg_names())
op2_output_names = op2.desc.output_arg_names()
if set(op1_output_names) & set(op2_input_names) or \
set(op1_input_names) & set(op2_output_names):
return True return True
return False return False
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册