Package ai.onnx.proto
Interface OnnxMl.TensorProtoOrBuilder
- All Superinterfaces:
com.google.protobuf.MessageLiteOrBuilder
,com.google.protobuf.MessageOrBuilder
- All Known Implementing Classes:
OnnxMl.TensorProto
,OnnxMl.TensorProto.Builder
- Enclosing class:
- OnnxMl
public static interface OnnxMl.TensorProtoOrBuilder
extends com.google.protobuf.MessageOrBuilder
-
Method Summary
Modifier and TypeMethodDescriptionIf value not set, data is stored in raw_data (if set) otherwise in type-specified field.int
The data type of the tensor.long
getDims
(int index) The shape of the tensor.int
The shape of the tensor.The shape of the tensor.A human-readable documentation for this tensor.com.google.protobuf.ByteString
A human-readable documentation for this tensor.double
getDoubleData
(int index) For double Complex128 tensors are encoded as a single array of doubles, with the real components appearing in odd numbered positions, and the corresponding imaginary component appearing in the subsequent even numbered position.int
For double Complex128 tensors are encoded as a single array of doubles, with the real components appearing in odd numbered positions, and the corresponding imaginary component appearing in the subsequent even numbered position.For double Complex128 tensors are encoded as a single array of doubles, with the real components appearing in odd numbered positions, and the corresponding imaginary component appearing in the subsequent even numbered position.getExternalData
(int index) Data can be stored inside the protobuf file using type-specific fields or raw_data.int
Data can be stored inside the protobuf file using type-specific fields or raw_data.Data can be stored inside the protobuf file using type-specific fields or raw_data.getExternalDataOrBuilder
(int index) Data can be stored inside the protobuf file using type-specific fields or raw_data.List<? extends OnnxMl.StringStringEntryProtoOrBuilder>
Data can be stored inside the protobuf file using type-specific fields or raw_data.float
getFloatData
(int index) For float and complex64 values Complex64 tensors are encoded as a single array of floats, with the real components appearing in odd numbered positions, and the corresponding imaginary component appearing in the subsequent even numbered position.int
For float and complex64 values Complex64 tensors are encoded as a single array of floats, with the real components appearing in odd numbered positions, and the corresponding imaginary component appearing in the subsequent even numbered position.For float and complex64 values Complex64 tensors are encoded as a single array of floats, with the real components appearing in odd numbered positions, and the corresponding imaginary component appearing in the subsequent even numbered position.int
getInt32Data
(int index) For int32, uint8, int8, uint16, int16, bool, and float16 values float16 values must be bit-wise converted to an uint16_t prior to writing to the buffer.int
For int32, uint8, int8, uint16, int16, bool, and float16 values float16 values must be bit-wise converted to an uint16_t prior to writing to the buffer.For int32, uint8, int8, uint16, int16, bool, and float16 values float16 values must be bit-wise converted to an uint16_t prior to writing to the buffer.long
getInt64Data
(int index) For int64.int
For int64.For int64.getName()
Optionally, a name for the tensor.com.google.protobuf.ByteString
Optionally, a name for the tensor.com.google.protobuf.ByteString
Serializations can either use one of the fields above, or use this raw bytes field.optional .onnx.TensorProto.Segment segment = 3;
optional .onnx.TensorProto.Segment segment = 3;
com.google.protobuf.ByteString
getStringData
(int index) For strings.int
For strings.List<com.google.protobuf.ByteString>
For strings.long
getUint64Data
(int index) For uint64 and uint32 values When this field is present, the data_type field MUST be UINT32 or UINT64int
For uint64 and uint32 values When this field is present, the data_type field MUST be UINT32 or UINT64For uint64 and uint32 values When this field is present, the data_type field MUST be UINT32 or UINT64boolean
If value not set, data is stored in raw_data (if set) otherwise in type-specified field.boolean
The data type of the tensor.boolean
A human-readable documentation for this tensor.boolean
hasName()
Optionally, a name for the tensor.boolean
Serializations can either use one of the fields above, or use this raw bytes field.boolean
optional .onnx.TensorProto.Segment segment = 3;
Methods inherited from interface com.google.protobuf.MessageLiteOrBuilder
isInitialized
Methods inherited from interface com.google.protobuf.MessageOrBuilder
findInitializationErrors, getAllFields, getDefaultInstanceForType, getDescriptorForType, getField, getInitializationErrorString, getOneofFieldDescriptor, getRepeatedField, getRepeatedFieldCount, getUnknownFields, hasField, hasOneof
-
Method Details
-
getDimsList
The shape of the tensor.
repeated int64 dims = 1;
- Returns:
- A list containing the dims.
-
getDimsCount
int getDimsCount()The shape of the tensor.
repeated int64 dims = 1;
- Returns:
- The count of dims.
-
getDims
long getDims(int index) The shape of the tensor.
repeated int64 dims = 1;
- Parameters:
index
- The index of the element to return.- Returns:
- The dims at the given index.
-
hasDataType
boolean hasDataType()The data type of the tensor. This field MUST have a valid TensorProto.DataType value
optional int32 data_type = 2;
- Returns:
- Whether the dataType field is set.
-
getDataType
int getDataType()The data type of the tensor. This field MUST have a valid TensorProto.DataType value
optional int32 data_type = 2;
- Returns:
- The dataType.
-
hasSegment
boolean hasSegment()optional .onnx.TensorProto.Segment segment = 3;
- Returns:
- Whether the segment field is set.
-
getSegment
OnnxMl.TensorProto.Segment getSegment()optional .onnx.TensorProto.Segment segment = 3;
- Returns:
- The segment.
-
getSegmentOrBuilder
OnnxMl.TensorProto.SegmentOrBuilder getSegmentOrBuilder()optional .onnx.TensorProto.Segment segment = 3;
-
getFloatDataList
For float and complex64 values Complex64 tensors are encoded as a single array of floats, with the real components appearing in odd numbered positions, and the corresponding imaginary component appearing in the subsequent even numbered position. (e.g., [1.0 + 2.0i, 3.0 + 4.0i] is encoded as [1.0, 2.0 ,3.0 ,4.0] When this field is present, the data_type field MUST be FLOAT or COMPLEX64.
repeated float float_data = 4 [packed = true];
- Returns:
- A list containing the floatData.
-
getFloatDataCount
int getFloatDataCount()For float and complex64 values Complex64 tensors are encoded as a single array of floats, with the real components appearing in odd numbered positions, and the corresponding imaginary component appearing in the subsequent even numbered position. (e.g., [1.0 + 2.0i, 3.0 + 4.0i] is encoded as [1.0, 2.0 ,3.0 ,4.0] When this field is present, the data_type field MUST be FLOAT or COMPLEX64.
repeated float float_data = 4 [packed = true];
- Returns:
- The count of floatData.
-
getFloatData
float getFloatData(int index) For float and complex64 values Complex64 tensors are encoded as a single array of floats, with the real components appearing in odd numbered positions, and the corresponding imaginary component appearing in the subsequent even numbered position. (e.g., [1.0 + 2.0i, 3.0 + 4.0i] is encoded as [1.0, 2.0 ,3.0 ,4.0] When this field is present, the data_type field MUST be FLOAT or COMPLEX64.
repeated float float_data = 4 [packed = true];
- Parameters:
index
- The index of the element to return.- Returns:
- The floatData at the given index.
-
getInt32DataList
For int32, uint8, int8, uint16, int16, bool, and float16 values float16 values must be bit-wise converted to an uint16_t prior to writing to the buffer. When this field is present, the data_type field MUST be INT32, INT16, INT8, UINT16, UINT8, BOOL, or FLOAT16
repeated int32 int32_data = 5 [packed = true];
- Returns:
- A list containing the int32Data.
-
getInt32DataCount
int getInt32DataCount()For int32, uint8, int8, uint16, int16, bool, and float16 values float16 values must be bit-wise converted to an uint16_t prior to writing to the buffer. When this field is present, the data_type field MUST be INT32, INT16, INT8, UINT16, UINT8, BOOL, or FLOAT16
repeated int32 int32_data = 5 [packed = true];
- Returns:
- The count of int32Data.
-
getInt32Data
int getInt32Data(int index) For int32, uint8, int8, uint16, int16, bool, and float16 values float16 values must be bit-wise converted to an uint16_t prior to writing to the buffer. When this field is present, the data_type field MUST be INT32, INT16, INT8, UINT16, UINT8, BOOL, or FLOAT16
repeated int32 int32_data = 5 [packed = true];
- Parameters:
index
- The index of the element to return.- Returns:
- The int32Data at the given index.
-
getStringDataList
List<com.google.protobuf.ByteString> getStringDataList()For strings. Each element of string_data is a UTF-8 encoded Unicode string. No trailing null, no leading BOM. The protobuf "string" scalar type is not used to match ML community conventions. When this field is present, the data_type field MUST be STRING
repeated bytes string_data = 6;
- Returns:
- A list containing the stringData.
-
getStringDataCount
int getStringDataCount()For strings. Each element of string_data is a UTF-8 encoded Unicode string. No trailing null, no leading BOM. The protobuf "string" scalar type is not used to match ML community conventions. When this field is present, the data_type field MUST be STRING
repeated bytes string_data = 6;
- Returns:
- The count of stringData.
-
getStringData
com.google.protobuf.ByteString getStringData(int index) For strings. Each element of string_data is a UTF-8 encoded Unicode string. No trailing null, no leading BOM. The protobuf "string" scalar type is not used to match ML community conventions. When this field is present, the data_type field MUST be STRING
repeated bytes string_data = 6;
- Parameters:
index
- The index of the element to return.- Returns:
- The stringData at the given index.
-
getInt64DataList
For int64. When this field is present, the data_type field MUST be INT64
repeated int64 int64_data = 7 [packed = true];
- Returns:
- A list containing the int64Data.
-
getInt64DataCount
int getInt64DataCount()For int64. When this field is present, the data_type field MUST be INT64
repeated int64 int64_data = 7 [packed = true];
- Returns:
- The count of int64Data.
-
getInt64Data
long getInt64Data(int index) For int64. When this field is present, the data_type field MUST be INT64
repeated int64 int64_data = 7 [packed = true];
- Parameters:
index
- The index of the element to return.- Returns:
- The int64Data at the given index.
-
hasName
boolean hasName()Optionally, a name for the tensor.
optional string name = 8;
- Returns:
- Whether the name field is set.
-
getName
String getName()Optionally, a name for the tensor.
optional string name = 8;
- Returns:
- The name.
-
getNameBytes
com.google.protobuf.ByteString getNameBytes()Optionally, a name for the tensor.
optional string name = 8;
- Returns:
- The bytes for name.
-
hasDocString
boolean hasDocString()A human-readable documentation for this tensor. Markdown is allowed.
optional string doc_string = 12;
- Returns:
- Whether the docString field is set.
-
getDocString
String getDocString()A human-readable documentation for this tensor. Markdown is allowed.
optional string doc_string = 12;
- Returns:
- The docString.
-
getDocStringBytes
com.google.protobuf.ByteString getDocStringBytes()A human-readable documentation for this tensor. Markdown is allowed.
optional string doc_string = 12;
- Returns:
- The bytes for docString.
-
hasRawData
boolean hasRawData()Serializations can either use one of the fields above, or use this raw bytes field. The only exception is the string case, where one is required to store the content in the repeated bytes string_data field. When this raw_data field is used to store tensor value, elements MUST be stored in as fixed-width, little-endian order. Floating-point data types MUST be stored in IEEE 754 format. Complex64 elements must be written as two consecutive FLOAT values, real component first. Complex128 elements must be written as two consecutive DOUBLE values, real component first. Boolean type MUST be written one byte per tensor element (00000001 for true, 00000000 for false). Note: the advantage of specific field rather than the raw_data field is that in some cases (e.g. int data), protobuf does a better packing via variable length storage, and may lead to smaller binary footprint. When this field is present, the data_type field MUST NOT be STRING or UNDEFINED
optional bytes raw_data = 9;
- Returns:
- Whether the rawData field is set.
-
getRawData
com.google.protobuf.ByteString getRawData()Serializations can either use one of the fields above, or use this raw bytes field. The only exception is the string case, where one is required to store the content in the repeated bytes string_data field. When this raw_data field is used to store tensor value, elements MUST be stored in as fixed-width, little-endian order. Floating-point data types MUST be stored in IEEE 754 format. Complex64 elements must be written as two consecutive FLOAT values, real component first. Complex128 elements must be written as two consecutive DOUBLE values, real component first. Boolean type MUST be written one byte per tensor element (00000001 for true, 00000000 for false). Note: the advantage of specific field rather than the raw_data field is that in some cases (e.g. int data), protobuf does a better packing via variable length storage, and may lead to smaller binary footprint. When this field is present, the data_type field MUST NOT be STRING or UNDEFINED
optional bytes raw_data = 9;
- Returns:
- The rawData.
-
getExternalDataList
List<OnnxMl.StringStringEntryProto> getExternalDataList()Data can be stored inside the protobuf file using type-specific fields or raw_data. Alternatively, raw bytes data can be stored in an external file, using the external_data field. external_data stores key-value pairs describing data location. Recognized keys are: - "location" (required) - POSIX filesystem path relative to the directory where the ONNX protobuf model was stored - "offset" (optional) - position of byte at which stored data begins. Integer stored as string. Offset values SHOULD be multiples 4096 (page size) to enable mmap support. - "length" (optional) - number of bytes containing data. Integer stored as string. - "checksum" (optional) - SHA1 digest of file specified in under 'location' key.
repeated .onnx.StringStringEntryProto external_data = 13;
-
getExternalData
Data can be stored inside the protobuf file using type-specific fields or raw_data. Alternatively, raw bytes data can be stored in an external file, using the external_data field. external_data stores key-value pairs describing data location. Recognized keys are: - "location" (required) - POSIX filesystem path relative to the directory where the ONNX protobuf model was stored - "offset" (optional) - position of byte at which stored data begins. Integer stored as string. Offset values SHOULD be multiples 4096 (page size) to enable mmap support. - "length" (optional) - number of bytes containing data. Integer stored as string. - "checksum" (optional) - SHA1 digest of file specified in under 'location' key.
repeated .onnx.StringStringEntryProto external_data = 13;
-
getExternalDataCount
int getExternalDataCount()Data can be stored inside the protobuf file using type-specific fields or raw_data. Alternatively, raw bytes data can be stored in an external file, using the external_data field. external_data stores key-value pairs describing data location. Recognized keys are: - "location" (required) - POSIX filesystem path relative to the directory where the ONNX protobuf model was stored - "offset" (optional) - position of byte at which stored data begins. Integer stored as string. Offset values SHOULD be multiples 4096 (page size) to enable mmap support. - "length" (optional) - number of bytes containing data. Integer stored as string. - "checksum" (optional) - SHA1 digest of file specified in under 'location' key.
repeated .onnx.StringStringEntryProto external_data = 13;
-
getExternalDataOrBuilderList
List<? extends OnnxMl.StringStringEntryProtoOrBuilder> getExternalDataOrBuilderList()Data can be stored inside the protobuf file using type-specific fields or raw_data. Alternatively, raw bytes data can be stored in an external file, using the external_data field. external_data stores key-value pairs describing data location. Recognized keys are: - "location" (required) - POSIX filesystem path relative to the directory where the ONNX protobuf model was stored - "offset" (optional) - position of byte at which stored data begins. Integer stored as string. Offset values SHOULD be multiples 4096 (page size) to enable mmap support. - "length" (optional) - number of bytes containing data. Integer stored as string. - "checksum" (optional) - SHA1 digest of file specified in under 'location' key.
repeated .onnx.StringStringEntryProto external_data = 13;
-
getExternalDataOrBuilder
Data can be stored inside the protobuf file using type-specific fields or raw_data. Alternatively, raw bytes data can be stored in an external file, using the external_data field. external_data stores key-value pairs describing data location. Recognized keys are: - "location" (required) - POSIX filesystem path relative to the directory where the ONNX protobuf model was stored - "offset" (optional) - position of byte at which stored data begins. Integer stored as string. Offset values SHOULD be multiples 4096 (page size) to enable mmap support. - "length" (optional) - number of bytes containing data. Integer stored as string. - "checksum" (optional) - SHA1 digest of file specified in under 'location' key.
repeated .onnx.StringStringEntryProto external_data = 13;
-
hasDataLocation
boolean hasDataLocation()If value not set, data is stored in raw_data (if set) otherwise in type-specified field.
optional .onnx.TensorProto.DataLocation data_location = 14;
- Returns:
- Whether the dataLocation field is set.
-
getDataLocation
OnnxMl.TensorProto.DataLocation getDataLocation()If value not set, data is stored in raw_data (if set) otherwise in type-specified field.
optional .onnx.TensorProto.DataLocation data_location = 14;
- Returns:
- The dataLocation.
-
getDoubleDataList
For double Complex128 tensors are encoded as a single array of doubles, with the real components appearing in odd numbered positions, and the corresponding imaginary component appearing in the subsequent even numbered position. (e.g., [1.0 + 2.0i, 3.0 + 4.0i] is encoded as [1.0, 2.0 ,3.0 ,4.0] When this field is present, the data_type field MUST be DOUBLE or COMPLEX128
repeated double double_data = 10 [packed = true];
- Returns:
- A list containing the doubleData.
-
getDoubleDataCount
int getDoubleDataCount()For double Complex128 tensors are encoded as a single array of doubles, with the real components appearing in odd numbered positions, and the corresponding imaginary component appearing in the subsequent even numbered position. (e.g., [1.0 + 2.0i, 3.0 + 4.0i] is encoded as [1.0, 2.0 ,3.0 ,4.0] When this field is present, the data_type field MUST be DOUBLE or COMPLEX128
repeated double double_data = 10 [packed = true];
- Returns:
- The count of doubleData.
-
getDoubleData
double getDoubleData(int index) For double Complex128 tensors are encoded as a single array of doubles, with the real components appearing in odd numbered positions, and the corresponding imaginary component appearing in the subsequent even numbered position. (e.g., [1.0 + 2.0i, 3.0 + 4.0i] is encoded as [1.0, 2.0 ,3.0 ,4.0] When this field is present, the data_type field MUST be DOUBLE or COMPLEX128
repeated double double_data = 10 [packed = true];
- Parameters:
index
- The index of the element to return.- Returns:
- The doubleData at the given index.
-
getUint64DataList
For uint64 and uint32 values When this field is present, the data_type field MUST be UINT32 or UINT64
repeated uint64 uint64_data = 11 [packed = true];
- Returns:
- A list containing the uint64Data.
-
getUint64DataCount
int getUint64DataCount()For uint64 and uint32 values When this field is present, the data_type field MUST be UINT32 or UINT64
repeated uint64 uint64_data = 11 [packed = true];
- Returns:
- The count of uint64Data.
-
getUint64Data
long getUint64Data(int index) For uint64 and uint32 values When this field is present, the data_type field MUST be UINT32 or UINT64
repeated uint64 uint64_data = 11 [packed = true];
- Parameters:
index
- The index of the element to return.- Returns:
- The uint64Data at the given index.
-