FunctionProto#

class onnx_light.onnx.FunctionProto(*args, **kwargs)#

A function defines a sub-operator that can be used in a graph. It is similar to a function in C/C++ or Python, and can be used to define reusable sub-graphs.

ByteSize(self) int#

Returns the serialized size in bytes, following the protobuf API.

CopyFrom(self, arg: onnx_light.onnx_py._onnxpy.FunctionProto, /) None#

Copies one instance into this one.

ParseFromFile(self, name: str, options: object | None = None, external_data_file: str = '') None#

Parses a binary file to fill this instance.

ParseFromString(self, data: bytes, options: object | None = None) None#
ParseFromString(self, data: str, options: object | None = None) None

Overloaded function.

  1. ParseFromString(self, data: bytes, options: object | None = None) -> None

Parses a sequence of bytes to fill this instance.

  1. ParseFromString(self, data: str, options: object | None = None) -> None

Parses a string to fill this instance.

SerializeSize(self, options: object | None = None) onnx_light.onnx_py._onnxpy.SerializeSizeResult#

Returns the size once serialized without serializing.

SerializeToFile(self, name: str, options: object | None = None, external_data_file: str = '') None#

Serializes this instance into a file. If external_data_size is not empty, big weights are stored in this (depending on options.raw_data_threshold). When writing to two files, temporary external-data metadata is cleared so the in-memory model stays unchanged.

SerializeToString(self, options: object | None = None) bytes#

Serializes this instance into a sequence of bytes.

property attribute#

attribute names of the function

property attribute_proto#

typed attributes

property doc_string#

A human-readable documentation for this graph. Markdown is allowed.

property domain#

The domain which this function belongs to. This is part of the unique-id (domain, name, overload) of FunctionProtos in a model.

has_attribute(self) bool#

Tells if ‘attribute’ has a value.

has_attribute_proto(self) bool#

Tells if ‘attribute_proto’ has a value.

has_doc_string(self) bool#

Tells if ‘doc_string’ has a value

has_domain(self) bool#

Tells if ‘domain’ has a value

has_input(self) bool#

Tells if ‘input’ has a value.

has_metadata_props(self) bool#

Tells if ‘metadata_props’ has a value.

has_name(self) bool#

Tells if ‘name’ has a value

has_node(self) bool#

Tells if ‘node’ has a value.

has_opset_import(self) bool#

Tells if ‘opset_import’ has a value.

has_output(self) bool#

Tells if ‘output’ has a value.

has_overload(self) bool#

Tells if ‘overload’ has a value

has_value_info(self) bool#

Tells if ‘value_info’ has a value.

property input#

input names of the function

property metadata_props#

Named metadata values; keys should be distinct.

property name#

The name of the function. This field MUST be present in this version of the IR.

property node#

The nodes in the graph, sorted topologically.

property opset_import#

The OperatorSets this function body (graph) relies on. All nodes in the function body (graph) will bind against the operator with the same-domain/same-op_type operator with the HIGHEST version in the referenced operator sets. This means at most one version can be relied for one domain. The operator sets imported by FunctionProto should be compatible with the ones imported by ModelProto. Example, if same operator set say ‘A’ is imported by FunctionProto and ModelProto then versions for the operator set may be different but, the operator schema returned for op_type, domain, version combination for both the versions should be same.

property output#

output names of the function

property overload#

The overload identifier of the function. This is part of the unique-id (domain, name, overload) of FunctionProtos in a model.

property value_info#

Information for the values in the graph. The ValueInfoProto.name’s must be distinct. It is optional for a value to appear in value_info list.