type_helper.h#
Provides the TensorType enumeration, the ToTypeString converter, and the SeqTypeOf/OptTypeOf/OptSeqTypeOf constexpr helpers used across the onnx-light library stack.
-
namespace onnx_light
Alias that makes onnx-light headers compatible with code that references
ONNX_LIGHT_NAMESPACE(the macro used in the standard onnx package).Set to
ONNX_LIGHT_NAMESPACEso both names resolve to the same namespace.Symbol-visibility attribute for the public onnx-light C++ API.
Maps the upstream compatibility macro to onnx-light’s explicit proto ABI annotation. This keeps declarations from vendored ONNX headers visible when
lib_onnx_protouses hidden visibility by default.Namespace alias so that ONNX C++ code (and consumers such as onnxruntime) that refers to the literal
onnxnamespace — rather than theONNX_NAMESPACEmacro — resolves to the onnx-light namespace. The standard onnx package lives innamespace onnx; onnx-light usesonnx_light(via ONNX_LIGHT_NAMESPACE), so this alias keeps onnx-light a true drop-in. It is only introduced when the onnx-light namespace differs fromonnx.-
namespace onnx_proto#
Enums
-
enum class TensorType : uint8_t#
Identifies an element or sequence tensor type supported by onnx-light.
Each enumerator corresponds to a concrete ONNX element type or to a sequence-of-tensor or optional-tensor type used in type-constraint definitions. The mapping from an enumerator to its canonical ONNX type string is implemented exhaustively by ToTypeString(); the naming convention is:
kXxx→"tensor(xxx)", e.g.kFloat→"tensor(float)",kInt64→"tensor(int64)",kBfloat16→"tensor(bfloat16)".kSeqXxx→"seq(tensor(xxx))", e.g.kSeqFloat→"seq(tensor(float))". The two map-valued sequences arekSeqMapStringFloat→"seq(map(string, float))"andkSeqMapInt64Float→"seq(map(int64, float))".kMapXxxYyy→"map(xxx, yyy)", e.g.kMapStringInt64→"map(string, int64)". Used for operators likeDictVectorizerwhose inputs are dictionaries.kOptXxx→"optional(tensor(xxx))"andkOptSeqXxx→"optional(seq(tensor(xxx)))".kUndefined→"tensor(undefined)".
Values:
-
enumerator kBool#
-
enumerator kString#
-
enumerator kUint8#
-
enumerator kUint16#
-
enumerator kUint32#
-
enumerator kUint64#
-
enumerator kInt8#
-
enumerator kInt16#
-
enumerator kInt32#
-
enumerator kInt64#
-
enumerator kFloat16#
-
enumerator kFloat#
-
enumerator kDouble#
-
enumerator kBfloat16#
-
enumerator kFloat8e4m3fn#
-
enumerator kFloat8e4m3fnuz#
-
enumerator kFloat8e5m2#
-
enumerator kFloat8e5m2fnuz#
-
enumerator kFloat8e8m0#
-
enumerator kFloat4e2m1#
-
enumerator kUint4#
-
enumerator kInt4#
-
enumerator kUint2#
-
enumerator kInt2#
-
enumerator kComplex64#
-
enumerator kComplex128#
-
enumerator kSeqBool#
-
enumerator kSeqString#
-
enumerator kSeqUint8#
-
enumerator kSeqUint16#
-
enumerator kSeqUint32#
-
enumerator kSeqUint64#
-
enumerator kSeqInt8#
-
enumerator kSeqInt16#
-
enumerator kSeqInt32#
-
enumerator kSeqInt64#
-
enumerator kSeqFloat16#
-
enumerator kSeqFloat#
-
enumerator kSeqDouble#
-
enumerator kSeqComplex64#
-
enumerator kSeqComplex128#
-
enumerator kSeqMapStringFloat#
-
enumerator kSeqMapInt64Float#
-
enumerator kMapStringInt64#
-
enumerator kMapInt64String#
-
enumerator kMapInt64Float#
-
enumerator kMapInt64Double#
-
enumerator kMapStringFloat#
-
enumerator kMapStringDouble#
-
enumerator kOptSeqBool#
-
enumerator kOptSeqString#
-
enumerator kOptSeqUint8#
-
enumerator kOptSeqUint16#
-
enumerator kOptSeqUint32#
-
enumerator kOptSeqUint64#
-
enumerator kOptSeqInt8#
-
enumerator kOptSeqInt16#
-
enumerator kOptSeqInt32#
-
enumerator kOptSeqInt64#
-
enumerator kOptSeqFloat16#
-
enumerator kOptSeqFloat#
-
enumerator kOptSeqDouble#
-
enumerator kOptSeqComplex64#
-
enumerator kOptSeqComplex128#
-
enumerator kOptBool#
-
enumerator kOptString#
-
enumerator kOptUint8#
-
enumerator kOptUint16#
-
enumerator kOptUint32#
-
enumerator kOptUint64#
-
enumerator kOptInt8#
-
enumerator kOptInt16#
-
enumerator kOptInt32#
-
enumerator kOptInt64#
-
enumerator kOptFloat16#
-
enumerator kOptFloat#
-
enumerator kOptDouble#
-
enumerator kOptComplex64#
-
enumerator kOptComplex128#
-
enumerator kUndefined#
Functions
-
inline constexpr const char *ToTypeString(TensorType type)#
Returns the ONNX type-string representation of a TensorType value.
- Parameters:
type – Tensor type enumerator to convert.
- Returns:
Null-terminated string such as
"tensor(float)"or"seq(tensor(int64))".
-
inline constexpr TensorType SeqTypeOf(TensorType elem)#
Maps a scalar tensor TensorType to the corresponding sequence TensorType (e.g. kFloat → kSeqFloat). Returns kUndefined when no sequence variant exists for the given element type (low-precision / extended float types that ONNX does not define sequence forms for).
-
inline constexpr TensorType OptTypeOf(TensorType elem)#
Maps a scalar tensor TensorType to the corresponding optional TensorType (e.g. kFloat → kOptFloat). Returns kUndefined when no optional variant exists for the given element type.
-
inline constexpr TensorType OptSeqTypeOf(TensorType elem)#
Maps a scalar tensor TensorType to the corresponding optional-sequence TensorType (e.g. kFloat → kOptSeqFloat). Returns kUndefined when no optional-sequence variant exists for the given element type.
-
enum class TensorType : uint8_t#
-
namespace onnx_proto#