def get_functions(domain=ONNX_DOMAIN): # type: ignore function_map = defaultdict(list) # type: Dict[int, List[FunctionProto]] function_byte_map = C.get_all_functions(domain) # type: ignore for function_name, raw_functions in function_byte_map.items(): for function_bytes in raw_functions: function_proto = FunctionProto() function_proto.ParseFromString(function_bytes) function_map[function_name].append(function_proto) return function_map
def _make_function( domain: str, fname: str, inputs: List[str], outputs: List[str], nodes: List[NodeProto], ) -> FunctionProto: f = FunctionProto() f.domain = domain f.name = fname f.input.extend(inputs) f.output.extend(outputs) f.node.extend(nodes) f.opset_import.extend(ops) return f
def _make_function( domain, # type: Text fname, # type: Text inputs, # type: List[Text] outputs, # type: List[Text] nodes, # type: List[NodeProto] ): # type: (...) -> FunctionProto f = FunctionProto() f.domain = domain f.name = fname f.input.extend(inputs) f.output.extend(outputs) f.node.extend(nodes) f.opset_import.extend(ops) return f
def make_function(domain: str, fname: str, inputs: Sequence[str], outputs: Sequence[str], nodes: Sequence[NodeProto], opset_imports: Sequence[OperatorSetIdProto], attributes: Optional[Sequence[str]] = [], doc_string: Optional[str] = None) -> FunctionProto: f = FunctionProto() f.domain = domain f.name = fname f.input.extend(inputs) f.output.extend(outputs) f.node.extend(nodes) f.opset_import.extend(opset_imports) f.attribute.extend(attributes) if doc_string: f.doc_string = doc_string return f
def _Function_proto(self): # type: ignore func_proto = FunctionProto() func_proto.ParseFromString(self._function_body) return func_proto