|
|
|
@ -176,6 +176,18 @@ class Operator(object):
|
|
|
|
|
proto = OpProtoHolder.instance().get_op_proto(type)
|
|
|
|
|
|
|
|
|
|
if inputs is not None:
|
|
|
|
|
given = set()
|
|
|
|
|
need = set()
|
|
|
|
|
for n in inputs:
|
|
|
|
|
given.add(n)
|
|
|
|
|
for m in proto.inputs:
|
|
|
|
|
need.add(m.name)
|
|
|
|
|
if not given == need:
|
|
|
|
|
raise ValueError(
|
|
|
|
|
"Incorrect setting for input(s) of operator \"%s\". Need: [%s] Given: [%s]"
|
|
|
|
|
% (type, ", ".join(str(e) for e in need), ", ".join(
|
|
|
|
|
str(e) for e in given)))
|
|
|
|
|
|
|
|
|
|
for in_proto in proto.inputs:
|
|
|
|
|
in_argus = inputs[in_proto.name]
|
|
|
|
|
if not isinstance(in_argus, list):
|
|
|
|
@ -190,6 +202,18 @@ class Operator(object):
|
|
|
|
|
self.desc.set_input(in_proto.name, in_argu_names)
|
|
|
|
|
|
|
|
|
|
if outputs is not None:
|
|
|
|
|
given = set()
|
|
|
|
|
need = set()
|
|
|
|
|
for n in outputs:
|
|
|
|
|
given.add(n)
|
|
|
|
|
for m in proto.outputs:
|
|
|
|
|
need.add(m.name)
|
|
|
|
|
if not given == need:
|
|
|
|
|
raise ValueError(
|
|
|
|
|
"Incorrect setting for output(s) of operator \"%s\". Need: [%s] Given: [%s]"
|
|
|
|
|
% (type, ", ".join(str(e) for e in need), ", ".join(
|
|
|
|
|
str(e) for e in given)))
|
|
|
|
|
|
|
|
|
|
for out_proto in proto.outputs:
|
|
|
|
|
out_argus = outputs[out_proto.name]
|
|
|
|
|
if not isinstance(out_argus, list):
|
|
|
|
|