| 1 | // |
| 2 | // WARNING: This file is automatically generated! Please edit onnx.in.proto. |
| 3 | // |
| 4 | |
| 5 | |
| 6 | // SPDX-License-Identifier: Apache-2.0 |
| 7 | |
| 8 | |
| 9 | syntax = "proto2"; |
| 10 | |
| 11 | package onnx; |
| 12 | import "onnx-ml.proto"; |
| 13 | |
| 14 | // This file contains the proto definitions for MapProto and |
| 15 | // SequenceProto. These protos are used to represent the data structures |
| 16 | // of maps and sequence for use in test data or ModelProto. |
| 17 | |
| 18 | // Sequences |
| 19 | // |
| 20 | // Defines a dense, ordered, collection of elements that are of homogeneous types. |
| 21 | // Sequences can be made out of tensors, maps, or sequences. |
| 22 | // |
| 23 | // If a sequence is made out of tensors, the tensors must have the same element |
| 24 | // type (i.e. int32). In some cases, the tensors in a sequence can have different |
| 25 | // shapes. Whether the tensors can have different shapes or not depends on the |
| 26 | // type/shape associated with the corresponding "ValueInfo". For example, |
| 27 | // "Sequence<Tensor<float, [M,N]>" means that all tensors have same shape. However, |
| 28 | // "Sequence<Tensor<float, [omitted,omitted]>" means they can have different |
| 29 | // shapes (all of rank 2), where "omitted" means the corresponding dimension has |
| 30 | // no symbolic/constant value. Finally, "Sequence<Tensor<float, omitted>>" means |
| 31 | // that the different tensors can have different ranks, when the "shape" itself |
| 32 | // is omitted from the tensor-type. For a more complete description, refer to |
| 33 | // https://github.com/onnx/onnx/blob/main/docs/IR.md#static-tensor-shapes. |
| 34 | // |
| 35 | message SequenceProto { |
| 36 | |
| 37 | optional string name = 1; |
| 38 | |
| 39 | enum DataType { |
| 40 | UNDEFINED = 0; |
| 41 | TENSOR = 1; |
| 42 | SPARSE_TENSOR = 2; |
| 43 | SEQUENCE = 3; |
| 44 | MAP = 4; |
| 45 | OPTIONAL = 5; |
| 46 | } |
| 47 | |
| 48 | // The data type of the element. |
| 49 | // This field MUST have a valid SequenceProto.DataType value |
| 50 | optional int32 elem_type = 2; |
| 51 | |
| 52 | // For TensorProto values. |
| 53 | // When this field is present, the elem_type field MUST be TENSOR. |
| 54 | repeated TensorProto tensor_values = 3; |
| 55 | |
| 56 | // For SparseTensorProto values. |
| 57 | // When this field is present, the elem_type field MUST be SPARSE_TENSOR. |
| 58 | repeated SparseTensorProto sparse_tensor_values = 4; |
| 59 | |
| 60 | // For SequenceProto values, allowing sequences to be of themselves. |
| 61 | // When this field is present, the elem_type field MUST be SEQUENCE. |
| 62 | repeated SequenceProto sequence_values = 5; |
| 63 | |
| 64 | // For MapProto values. |
| 65 | // When this field is present, the elem_type field MUST be MAP. |
| 66 | repeated MapProto map_values = 6; |
| 67 | |
| 68 | // For OptionalProto values. |
| 69 | // When this field is present, the elem_type field MUST be Optional. |
| 70 | repeated OptionalProto optional_values = 7; |
| 71 | |
| 72 | } |
| 73 | |
| 74 | |
| 75 | // Maps |
| 76 | // |
| 77 | // Specifies an associative table, defined by keys and values. |
| 78 | // MapProto is formed with a repeated field of keys (of type INT8, INT16, INT32, |
| 79 | // INT64, UINT8, UINT16, UINT32, UINT64, or STRING) and values (of type TENSOR, |
| 80 | // SPARSE_TENSOR, SEQUENCE, or MAP). Key types and value types have to remain |
| 81 | // the same throughout the instantiation of the MapProto. |
| 82 | // |
| 83 | message MapProto { |
| 84 | |
| 85 | optional string name = 1; |
| 86 | |
| 87 | // All MapProto data types must have the same length of keys and values. |
| 88 | |
| 89 | // The data type of the key. |
| 90 | // This field MUST have a valid TensorProto.DataType value of |
| 91 | // INT8, INT16, INT32, INT64, UINT8, UINT16, UINT32, UINT64, or STRING |
| 92 | optional int32 key_type = 2; |
| 93 | |
| 94 | // Every element of keys has to be one of the following data types |
| 95 | // INT8, INT16, INT32, INT64, UINT8, UINT16, UINT32, UINT64, or STRING. |
| 96 | // The integer cases are represented by the repeated int64 field keys below. |
| 97 | repeated int64 keys = 3; |
| 98 | |
| 99 | // If keys are strings, they are represented by the repeated bytes field |
| 100 | // string_keys below. |
| 101 | repeated bytes string_keys = 4; |
| 102 | |
| 103 | // MapProto values are represented in a SequenceProto of the same length as the |
| 104 | // repeated keys field and have to be one of the following data types |
| 105 | // TENSOR, SPARSE_TENSOR, MAP, SEQUENCE. |
| 106 | optional SequenceProto values = 5; |
| 107 | } |
| 108 | |
| 109 | // Optional |
| 110 | // |
| 111 | // |
| 112 | message OptionalProto { |
| 113 | |
| 114 | optional string name = 1; |
| 115 | |
| 116 | enum DataType { |
| 117 | UNDEFINED = 0; |
| 118 | TENSOR = 1; |
| 119 | SPARSE_TENSOR = 2; |
| 120 | SEQUENCE = 3; |
| 121 | MAP = 4; |
| 122 | OPTIONAL = 5; |
| 123 | } |
| 124 | |
| 125 | // The data type of the element, identifies if the OptionalProto value |
| 126 | // is Tensor, Sparse Tensor, Sequence, Map, or Optional. |
| 127 | // The type of the optional value MUST match the elem_type specified. |
| 128 | // This field MUST have a valid OptionalProto.DataType value. |
| 129 | optional int32 elem_type = 2; |
| 130 | |
| 131 | // For TensorProto value. |
| 132 | // When this field is present, the elem_type field MUST be TENSOR. |
| 133 | optional TensorProto tensor_value = 3; |
| 134 | |
| 135 | // For SparseTensorProto value. |
| 136 | // When this field is present, the elem_type field MUST be SPARSE_TENSOR. |
| 137 | optional SparseTensorProto sparse_tensor_value = 4; |
| 138 | |
| 139 | // For SequenceProto value. |
| 140 | // When this field is present, the elem_type field MUST be SEQUENCE. |
| 141 | optional SequenceProto sequence_value = 5; |
| 142 | |
| 143 | // For MapProto value. |
| 144 | // When this field is present, the elem_type field MUST be MAP. |
| 145 | optional MapProto map_value = 6; |
| 146 | |
| 147 | // For OptionalProto value, allowing optional to be of itself (completeness) |
| 148 | // When this field is present, the elem_type field MUST be OPTIONAL. |
| 149 | optional OptionalProto optional_value = 7; |
| 150 | |
| 151 | } |
| 152 | |
| 153 | // For using protobuf-lite |
| 154 | option optimize_for = LITE_RUNTIME; |
| 155 | |