提交 a4278559 编写于 作者: F fengjiayi

Update

上级 53222cb9
...@@ -71,20 +71,18 @@ class Variable(object): ...@@ -71,20 +71,18 @@ class Variable(object):
class Operator(object): class Operator(object):
def __init__(self, def __init__(self, block, desc, type, inputs=None, outputs=None,
block,
proto,
type=None,
inputs=None,
outputs=None,
attrs=None): attrs=None):
self.block = block self.block = block
self.proto = proto self.desc = desc
if type is not None: self.proto = OpProtoHolder.instance().get_op_proto(type)
self.proto.set_type(type) self.desc.set_type(type)
if inputs is not None: if inputs is not None:
for k, v in inputs.iteritems(): for in_proto in self.proto.inputs:
self.proto.set_input(k, v) in_argu = inputs[in_proto.name]
if is_str(in_argu):
in_argu = [in_argu]
if outputs is not None: if outputs is not None:
for k, v in outputs.iteritems(): for k, v in outputs.iteritems():
self.proto.set_output(k, v) self.proto.set_output(k, v)
...@@ -114,8 +112,8 @@ class Block(object): ...@@ -114,8 +112,8 @@ class Block(object):
return Variable(self, *args, **kwargs) return Variable(self, *args, **kwargs)
def append_op(self, *args, **kwargs): def append_op(self, *args, **kwargs):
op_proto = self.proto.append_op() op_desc = self.proto.append_op()
op = Operator(self, op_proto, *args, **kwargs) op = Operator(self, op_desc, *args, **kwargs)
self.ops.append(op) self.ops.append(op)
return op return op
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册