未验证 提交 044d671e 编写于 作者: F fengjiayi 提交者: GitHub

Rename 'argu' in framework.py to 'arg' (#5723)

上级 56f28a0f
...@@ -4,7 +4,10 @@ import collections ...@@ -4,7 +4,10 @@ import collections
import numpy as np import numpy as np
import copy import copy
__all__ = ['Block', 'Variable', 'Program', 'Operator', 'default_startup_program', 'default_main_program'] __all__ = [
'Block', 'Variable', 'Program', 'Operator', 'default_startup_program',
'default_main_program'
]
def unique_name(prefix): def unique_name(prefix):
...@@ -232,17 +235,17 @@ class Operator(object): ...@@ -232,17 +235,17 @@ class Operator(object):
in_proto.name) in_proto.name)
if found: if found:
in_argus = inputs[in_proto.name] in_args = inputs[in_proto.name]
if not isinstance(in_argus, list): if not isinstance(in_args, list):
in_argus = [in_argus] in_args = [in_args]
if not in_proto.duplicable and len(in_argus) > 1: if not in_proto.duplicable and len(in_args) > 1:
raise ValueError( raise ValueError(
"Input %s expects only one input, but %d are given." "Input %s expects only one input, but %d are given."
% (in_proto.name, len(in_argus))) % (in_proto.name, len(in_args)))
in_argu_names = [] in_arg_names = []
for argu in in_argus: for arg in in_args:
in_argu_names.append(argu.name) in_arg_names.append(arg.name)
self.desc.set_input(in_proto.name, in_argu_names) self.desc.set_input(in_proto.name, in_arg_names)
else: else:
self.desc.set_input(in_proto.name, []) self.desc.set_input(in_proto.name, [])
...@@ -260,18 +263,18 @@ class Operator(object): ...@@ -260,18 +263,18 @@ class Operator(object):
str(e) for e in given))) str(e) for e in given)))
for out_proto in proto.outputs: for out_proto in proto.outputs:
out_argus = outputs[out_proto.name] out_args = outputs[out_proto.name]
if not isinstance(out_argus, list): if not isinstance(out_args, list):
out_argus = [out_argus] out_args = [out_args]
if not out_proto.duplicable and len(out_argus) > 1: if not out_proto.duplicable and len(out_args) > 1:
raise ValueError( raise ValueError(
"Output %s expects only one output, but %d are given." % "Output %s expects only one output, but %d are given." %
(out_proto.name, len(out_argus))) (out_proto.name, len(out_args)))
out_argu_names = [] out_arg_names = []
for argu in out_argus: for arg in out_args:
out_argu_names.append(argu.name) out_arg_names.append(arg.name)
argu.op = self arg.op = self
self.desc.set_output(out_proto.name, out_argu_names) self.desc.set_output(out_proto.name, out_arg_names)
if attrs is not None: if attrs is not None:
if not isinstance(attrs, dict): if not isinstance(attrs, dict):
...@@ -582,8 +585,10 @@ class Parameter(Variable): ...@@ -582,8 +585,10 @@ class Parameter(Variable):
g_main_program = Program() g_main_program = Program()
g_startup_program = Program() g_startup_program = Program()
def default_startup_program(): def default_startup_program():
return g_startup_program return g_startup_program
def default_main_program(): def default_main_program():
return g_main_program return g_main_program
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册