Package onnx

Class OnnxMl.ModelProto

  • All Implemented Interfaces:
    Serializable, OnnxMl.ModelProtoOrBuilder, org.nd4j.shade.protobuf.Message, org.nd4j.shade.protobuf.MessageLite, org.nd4j.shade.protobuf.MessageLiteOrBuilder, org.nd4j.shade.protobuf.MessageOrBuilder
    Enclosing class:
    OnnxMl

    public static final class OnnxMl.ModelProto
    extends org.nd4j.shade.protobuf.GeneratedMessageV3
    implements OnnxMl.ModelProtoOrBuilder
     Models
     ModelProto is a top-level file/container format for bundling a ML model and
     associating its computation graph with metadata.
     The semantics of the model are described by the associated GraphProto's.
     
    Protobuf type onnx.ModelProto
    See Also:
    Serialized Form
    • Method Detail

      • newInstance

        protected Object newInstance​(org.nd4j.shade.protobuf.GeneratedMessageV3.UnusedPrivateParameter unused)
        Overrides:
        newInstance in class org.nd4j.shade.protobuf.GeneratedMessageV3
      • getUnknownFields

        public final org.nd4j.shade.protobuf.UnknownFieldSet getUnknownFields()
        Specified by:
        getUnknownFields in interface org.nd4j.shade.protobuf.MessageOrBuilder
        Overrides:
        getUnknownFields in class org.nd4j.shade.protobuf.GeneratedMessageV3
      • getDescriptor

        public static final org.nd4j.shade.protobuf.Descriptors.Descriptor getDescriptor()
      • internalGetFieldAccessorTable

        protected org.nd4j.shade.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
        Specified by:
        internalGetFieldAccessorTable in class org.nd4j.shade.protobuf.GeneratedMessageV3
      • getIrVersion

        public long getIrVersion()
         The version of the IR this model targets. See Version enum above.
         This field MUST be present.
         
        int64 ir_version = 1;
        Specified by:
        getIrVersion in interface OnnxMl.ModelProtoOrBuilder
        Returns:
        The irVersion.
      • getOpsetImportList

        public List<OnnxMl.OperatorSetIdProto> getOpsetImportList()
         The OperatorSets this model relies on.
         All ModelProtos MUST have at least one entry that
         specifies which version of the ONNX OperatorSet is
         being imported.
         All nodes in the ModelProto's graph will bind against the operator
         with the same-domain/same-op_type operator with the HIGHEST version
         in the referenced operator sets.
         
        repeated .onnx.OperatorSetIdProto opset_import = 8;
        Specified by:
        getOpsetImportList in interface OnnxMl.ModelProtoOrBuilder
      • getOpsetImportOrBuilderList

        public List<? extends OnnxMl.OperatorSetIdProtoOrBuilder> getOpsetImportOrBuilderList()
         The OperatorSets this model relies on.
         All ModelProtos MUST have at least one entry that
         specifies which version of the ONNX OperatorSet is
         being imported.
         All nodes in the ModelProto's graph will bind against the operator
         with the same-domain/same-op_type operator with the HIGHEST version
         in the referenced operator sets.
         
        repeated .onnx.OperatorSetIdProto opset_import = 8;
        Specified by:
        getOpsetImportOrBuilderList in interface OnnxMl.ModelProtoOrBuilder
      • getOpsetImportCount

        public int getOpsetImportCount()
         The OperatorSets this model relies on.
         All ModelProtos MUST have at least one entry that
         specifies which version of the ONNX OperatorSet is
         being imported.
         All nodes in the ModelProto's graph will bind against the operator
         with the same-domain/same-op_type operator with the HIGHEST version
         in the referenced operator sets.
         
        repeated .onnx.OperatorSetIdProto opset_import = 8;
        Specified by:
        getOpsetImportCount in interface OnnxMl.ModelProtoOrBuilder
      • getOpsetImport

        public OnnxMl.OperatorSetIdProto getOpsetImport​(int index)
         The OperatorSets this model relies on.
         All ModelProtos MUST have at least one entry that
         specifies which version of the ONNX OperatorSet is
         being imported.
         All nodes in the ModelProto's graph will bind against the operator
         with the same-domain/same-op_type operator with the HIGHEST version
         in the referenced operator sets.
         
        repeated .onnx.OperatorSetIdProto opset_import = 8;
        Specified by:
        getOpsetImport in interface OnnxMl.ModelProtoOrBuilder
      • getOpsetImportOrBuilder

        public OnnxMl.OperatorSetIdProtoOrBuilder getOpsetImportOrBuilder​(int index)
         The OperatorSets this model relies on.
         All ModelProtos MUST have at least one entry that
         specifies which version of the ONNX OperatorSet is
         being imported.
         All nodes in the ModelProto's graph will bind against the operator
         with the same-domain/same-op_type operator with the HIGHEST version
         in the referenced operator sets.
         
        repeated .onnx.OperatorSetIdProto opset_import = 8;
        Specified by:
        getOpsetImportOrBuilder in interface OnnxMl.ModelProtoOrBuilder
      • getProducerName

        public String getProducerName()
         The name of the framework or tool used to generate this model.
         This field SHOULD be present to indicate which implementation/tool/framework
         emitted the model.
         
        string producer_name = 2;
        Specified by:
        getProducerName in interface OnnxMl.ModelProtoOrBuilder
        Returns:
        The producerName.
      • getProducerNameBytes

        public org.nd4j.shade.protobuf.ByteString getProducerNameBytes()
         The name of the framework or tool used to generate this model.
         This field SHOULD be present to indicate which implementation/tool/framework
         emitted the model.
         
        string producer_name = 2;
        Specified by:
        getProducerNameBytes in interface OnnxMl.ModelProtoOrBuilder
        Returns:
        The bytes for producerName.
      • getProducerVersion

        public String getProducerVersion()
         The version of the framework or tool used to generate this model.
         This field SHOULD be present to indicate which implementation/tool/framework
         emitted the model.
         
        string producer_version = 3;
        Specified by:
        getProducerVersion in interface OnnxMl.ModelProtoOrBuilder
        Returns:
        The producerVersion.
      • getProducerVersionBytes

        public org.nd4j.shade.protobuf.ByteString getProducerVersionBytes()
         The version of the framework or tool used to generate this model.
         This field SHOULD be present to indicate which implementation/tool/framework
         emitted the model.
         
        string producer_version = 3;
        Specified by:
        getProducerVersionBytes in interface OnnxMl.ModelProtoOrBuilder
        Returns:
        The bytes for producerVersion.
      • getDomain

        public String getDomain()
         Domain name of the model.
         We use reverse domain names as name space indicators. For example:
         `com.facebook.fair` or `com.microsoft.cognitiveservices`
         Together with `model_version` and GraphProto.name, this forms the unique identity of
         the graph.
         
        string domain = 4;
        Specified by:
        getDomain in interface OnnxMl.ModelProtoOrBuilder
        Returns:
        The domain.
      • getDomainBytes

        public org.nd4j.shade.protobuf.ByteString getDomainBytes()
         Domain name of the model.
         We use reverse domain names as name space indicators. For example:
         `com.facebook.fair` or `com.microsoft.cognitiveservices`
         Together with `model_version` and GraphProto.name, this forms the unique identity of
         the graph.
         
        string domain = 4;
        Specified by:
        getDomainBytes in interface OnnxMl.ModelProtoOrBuilder
        Returns:
        The bytes for domain.
      • getModelVersion

        public long getModelVersion()
         The version of the graph encoded. See Version enum below.
         
        int64 model_version = 5;
        Specified by:
        getModelVersion in interface OnnxMl.ModelProtoOrBuilder
        Returns:
        The modelVersion.
      • getDocString

        public String getDocString()
         A human-readable documentation for this model. Markdown is allowed.
         
        string doc_string = 6;
        Specified by:
        getDocString in interface OnnxMl.ModelProtoOrBuilder
        Returns:
        The docString.
      • getDocStringBytes

        public org.nd4j.shade.protobuf.ByteString getDocStringBytes()
         A human-readable documentation for this model. Markdown is allowed.
         
        string doc_string = 6;
        Specified by:
        getDocStringBytes in interface OnnxMl.ModelProtoOrBuilder
        Returns:
        The bytes for docString.
      • hasGraph

        public boolean hasGraph()
         The parameterized graph that is evaluated to execute the model.
         
        .onnx.GraphProto graph = 7;
        Specified by:
        hasGraph in interface OnnxMl.ModelProtoOrBuilder
        Returns:
        Whether the graph field is set.
      • getMetadataPropsCount

        public int getMetadataPropsCount()
         Named metadata values; keys should be distinct.
         
        repeated .onnx.StringStringEntryProto metadata_props = 14;
        Specified by:
        getMetadataPropsCount in interface OnnxMl.ModelProtoOrBuilder
      • getTrainingInfoList

        public List<OnnxMl.TrainingInfoProto> getTrainingInfoList()
         Training-specific information. Sequentially executing all stored
         `TrainingInfoProto.algorithm`s and assigning their outputs following
         the corresponding `TrainingInfoProto.update_binding`s is one training
         iteration. Similarly, to initialize the model
         (as if training hasn't happened), the user should sequentially execute
         all stored `TrainingInfoProto.initialization`s and assigns their outputs
         using `TrainingInfoProto.initialization_binding`s.
         If this field is empty, the training behavior of the model is undefined.
         
        repeated .onnx.TrainingInfoProto training_info = 20;
        Specified by:
        getTrainingInfoList in interface OnnxMl.ModelProtoOrBuilder
      • getTrainingInfoOrBuilderList

        public List<? extends OnnxMl.TrainingInfoProtoOrBuilder> getTrainingInfoOrBuilderList()
         Training-specific information. Sequentially executing all stored
         `TrainingInfoProto.algorithm`s and assigning their outputs following
         the corresponding `TrainingInfoProto.update_binding`s is one training
         iteration. Similarly, to initialize the model
         (as if training hasn't happened), the user should sequentially execute
         all stored `TrainingInfoProto.initialization`s and assigns their outputs
         using `TrainingInfoProto.initialization_binding`s.
         If this field is empty, the training behavior of the model is undefined.
         
        repeated .onnx.TrainingInfoProto training_info = 20;
        Specified by:
        getTrainingInfoOrBuilderList in interface OnnxMl.ModelProtoOrBuilder
      • getTrainingInfoCount

        public int getTrainingInfoCount()
         Training-specific information. Sequentially executing all stored
         `TrainingInfoProto.algorithm`s and assigning their outputs following
         the corresponding `TrainingInfoProto.update_binding`s is one training
         iteration. Similarly, to initialize the model
         (as if training hasn't happened), the user should sequentially execute
         all stored `TrainingInfoProto.initialization`s and assigns their outputs
         using `TrainingInfoProto.initialization_binding`s.
         If this field is empty, the training behavior of the model is undefined.
         
        repeated .onnx.TrainingInfoProto training_info = 20;
        Specified by:
        getTrainingInfoCount in interface OnnxMl.ModelProtoOrBuilder
      • getTrainingInfo

        public OnnxMl.TrainingInfoProto getTrainingInfo​(int index)
         Training-specific information. Sequentially executing all stored
         `TrainingInfoProto.algorithm`s and assigning their outputs following
         the corresponding `TrainingInfoProto.update_binding`s is one training
         iteration. Similarly, to initialize the model
         (as if training hasn't happened), the user should sequentially execute
         all stored `TrainingInfoProto.initialization`s and assigns their outputs
         using `TrainingInfoProto.initialization_binding`s.
         If this field is empty, the training behavior of the model is undefined.
         
        repeated .onnx.TrainingInfoProto training_info = 20;
        Specified by:
        getTrainingInfo in interface OnnxMl.ModelProtoOrBuilder
      • getTrainingInfoOrBuilder

        public OnnxMl.TrainingInfoProtoOrBuilder getTrainingInfoOrBuilder​(int index)
         Training-specific information. Sequentially executing all stored
         `TrainingInfoProto.algorithm`s and assigning their outputs following
         the corresponding `TrainingInfoProto.update_binding`s is one training
         iteration. Similarly, to initialize the model
         (as if training hasn't happened), the user should sequentially execute
         all stored `TrainingInfoProto.initialization`s and assigns their outputs
         using `TrainingInfoProto.initialization_binding`s.
         If this field is empty, the training behavior of the model is undefined.
         
        repeated .onnx.TrainingInfoProto training_info = 20;
        Specified by:
        getTrainingInfoOrBuilder in interface OnnxMl.ModelProtoOrBuilder
      • getFunctionsList

        public List<OnnxMl.FunctionProto> getFunctionsList()
         A list of function protos local to the model.
         Name of the function "FunctionProto.name" should be unique within the domain "FunctionProto.domain".
         In case of any conflicts the behavior (whether the model local functions are given higher priority,
         or standard opserator sets are given higher priotity or this is treated as error) is defined by
         the runtimes.
         The operator sets imported by FunctionProto should be compatible with the ones
         imported by ModelProto and other model local FunctionProtos.
         Example, if same operator set say 'A' is imported by a FunctionProto and ModelProto
         or by 2 FunctionProtos 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 for every node in the function body.
         One FunctionProto can reference other FunctionProto in the model, however, recursive reference
         is not allowed.
         
        repeated .onnx.FunctionProto functions = 25;
        Specified by:
        getFunctionsList in interface OnnxMl.ModelProtoOrBuilder
      • getFunctionsOrBuilderList

        public List<? extends OnnxMl.FunctionProtoOrBuilder> getFunctionsOrBuilderList()
         A list of function protos local to the model.
         Name of the function "FunctionProto.name" should be unique within the domain "FunctionProto.domain".
         In case of any conflicts the behavior (whether the model local functions are given higher priority,
         or standard opserator sets are given higher priotity or this is treated as error) is defined by
         the runtimes.
         The operator sets imported by FunctionProto should be compatible with the ones
         imported by ModelProto and other model local FunctionProtos.
         Example, if same operator set say 'A' is imported by a FunctionProto and ModelProto
         or by 2 FunctionProtos 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 for every node in the function body.
         One FunctionProto can reference other FunctionProto in the model, however, recursive reference
         is not allowed.
         
        repeated .onnx.FunctionProto functions = 25;
        Specified by:
        getFunctionsOrBuilderList in interface OnnxMl.ModelProtoOrBuilder
      • getFunctionsCount

        public int getFunctionsCount()
         A list of function protos local to the model.
         Name of the function "FunctionProto.name" should be unique within the domain "FunctionProto.domain".
         In case of any conflicts the behavior (whether the model local functions are given higher priority,
         or standard opserator sets are given higher priotity or this is treated as error) is defined by
         the runtimes.
         The operator sets imported by FunctionProto should be compatible with the ones
         imported by ModelProto and other model local FunctionProtos.
         Example, if same operator set say 'A' is imported by a FunctionProto and ModelProto
         or by 2 FunctionProtos 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 for every node in the function body.
         One FunctionProto can reference other FunctionProto in the model, however, recursive reference
         is not allowed.
         
        repeated .onnx.FunctionProto functions = 25;
        Specified by:
        getFunctionsCount in interface OnnxMl.ModelProtoOrBuilder
      • getFunctions

        public OnnxMl.FunctionProto getFunctions​(int index)
         A list of function protos local to the model.
         Name of the function "FunctionProto.name" should be unique within the domain "FunctionProto.domain".
         In case of any conflicts the behavior (whether the model local functions are given higher priority,
         or standard opserator sets are given higher priotity or this is treated as error) is defined by
         the runtimes.
         The operator sets imported by FunctionProto should be compatible with the ones
         imported by ModelProto and other model local FunctionProtos.
         Example, if same operator set say 'A' is imported by a FunctionProto and ModelProto
         or by 2 FunctionProtos 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 for every node in the function body.
         One FunctionProto can reference other FunctionProto in the model, however, recursive reference
         is not allowed.
         
        repeated .onnx.FunctionProto functions = 25;
        Specified by:
        getFunctions in interface OnnxMl.ModelProtoOrBuilder
      • getFunctionsOrBuilder

        public OnnxMl.FunctionProtoOrBuilder getFunctionsOrBuilder​(int index)
         A list of function protos local to the model.
         Name of the function "FunctionProto.name" should be unique within the domain "FunctionProto.domain".
         In case of any conflicts the behavior (whether the model local functions are given higher priority,
         or standard opserator sets are given higher priotity or this is treated as error) is defined by
         the runtimes.
         The operator sets imported by FunctionProto should be compatible with the ones
         imported by ModelProto and other model local FunctionProtos.
         Example, if same operator set say 'A' is imported by a FunctionProto and ModelProto
         or by 2 FunctionProtos 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 for every node in the function body.
         One FunctionProto can reference other FunctionProto in the model, however, recursive reference
         is not allowed.
         
        repeated .onnx.FunctionProto functions = 25;
        Specified by:
        getFunctionsOrBuilder in interface OnnxMl.ModelProtoOrBuilder
      • isInitialized

        public final boolean isInitialized()
        Specified by:
        isInitialized in interface org.nd4j.shade.protobuf.MessageLiteOrBuilder
        Overrides:
        isInitialized in class org.nd4j.shade.protobuf.GeneratedMessageV3
      • writeTo

        public void writeTo​(org.nd4j.shade.protobuf.CodedOutputStream output)
                     throws IOException
        Specified by:
        writeTo in interface org.nd4j.shade.protobuf.MessageLite
        Overrides:
        writeTo in class org.nd4j.shade.protobuf.GeneratedMessageV3
        Throws:
        IOException
      • getSerializedSize

        public int getSerializedSize()
        Specified by:
        getSerializedSize in interface org.nd4j.shade.protobuf.MessageLite
        Overrides:
        getSerializedSize in class org.nd4j.shade.protobuf.GeneratedMessageV3
      • equals

        public boolean equals​(Object obj)
        Specified by:
        equals in interface org.nd4j.shade.protobuf.Message
        Overrides:
        equals in class org.nd4j.shade.protobuf.AbstractMessage
      • hashCode

        public int hashCode()
        Specified by:
        hashCode in interface org.nd4j.shade.protobuf.Message
        Overrides:
        hashCode in class org.nd4j.shade.protobuf.AbstractMessage
      • parseFrom

        public static OnnxMl.ModelProto parseFrom​(ByteBuffer data)
                                           throws org.nd4j.shade.protobuf.InvalidProtocolBufferException
        Throws:
        org.nd4j.shade.protobuf.InvalidProtocolBufferException
      • parseFrom

        public static OnnxMl.ModelProto parseFrom​(ByteBuffer data,
                                                  org.nd4j.shade.protobuf.ExtensionRegistryLite extensionRegistry)
                                           throws org.nd4j.shade.protobuf.InvalidProtocolBufferException
        Throws:
        org.nd4j.shade.protobuf.InvalidProtocolBufferException
      • parseFrom

        public static OnnxMl.ModelProto parseFrom​(org.nd4j.shade.protobuf.ByteString data)
                                           throws org.nd4j.shade.protobuf.InvalidProtocolBufferException
        Throws:
        org.nd4j.shade.protobuf.InvalidProtocolBufferException
      • parseFrom

        public static OnnxMl.ModelProto parseFrom​(org.nd4j.shade.protobuf.ByteString data,
                                                  org.nd4j.shade.protobuf.ExtensionRegistryLite extensionRegistry)
                                           throws org.nd4j.shade.protobuf.InvalidProtocolBufferException
        Throws:
        org.nd4j.shade.protobuf.InvalidProtocolBufferException
      • parseFrom

        public static OnnxMl.ModelProto parseFrom​(byte[] data)
                                           throws org.nd4j.shade.protobuf.InvalidProtocolBufferException
        Throws:
        org.nd4j.shade.protobuf.InvalidProtocolBufferException
      • parseFrom

        public static OnnxMl.ModelProto parseFrom​(byte[] data,
                                                  org.nd4j.shade.protobuf.ExtensionRegistryLite extensionRegistry)
                                           throws org.nd4j.shade.protobuf.InvalidProtocolBufferException
        Throws:
        org.nd4j.shade.protobuf.InvalidProtocolBufferException
      • parseFrom

        public static OnnxMl.ModelProto parseFrom​(org.nd4j.shade.protobuf.CodedInputStream input,
                                                  org.nd4j.shade.protobuf.ExtensionRegistryLite extensionRegistry)
                                           throws IOException
        Throws:
        IOException
      • newBuilderForType

        public OnnxMl.ModelProto.Builder newBuilderForType()
        Specified by:
        newBuilderForType in interface org.nd4j.shade.protobuf.Message
        Specified by:
        newBuilderForType in interface org.nd4j.shade.protobuf.MessageLite
      • toBuilder

        public OnnxMl.ModelProto.Builder toBuilder()
        Specified by:
        toBuilder in interface org.nd4j.shade.protobuf.Message
        Specified by:
        toBuilder in interface org.nd4j.shade.protobuf.MessageLite
      • newBuilderForType

        protected OnnxMl.ModelProto.Builder newBuilderForType​(org.nd4j.shade.protobuf.GeneratedMessageV3.BuilderParent parent)
        Specified by:
        newBuilderForType in class org.nd4j.shade.protobuf.GeneratedMessageV3
      • getParserForType

        public org.nd4j.shade.protobuf.Parser<OnnxMl.ModelProto> getParserForType()
        Specified by:
        getParserForType in interface org.nd4j.shade.protobuf.Message
        Specified by:
        getParserForType in interface org.nd4j.shade.protobuf.MessageLite
        Overrides:
        getParserForType in class org.nd4j.shade.protobuf.GeneratedMessageV3
      • getDefaultInstanceForType

        public OnnxMl.ModelProto getDefaultInstanceForType()
        Specified by:
        getDefaultInstanceForType in interface org.nd4j.shade.protobuf.MessageLiteOrBuilder
        Specified by:
        getDefaultInstanceForType in interface org.nd4j.shade.protobuf.MessageOrBuilder