onnx.mapping

This module defines the correspondence between onnx numerical types and numpy numerical types. This information can be accessed through attribute TENSOR_TYPE_MAP or through the functions defined in onnx.helper.

TensorDtypeMap

class onnx.mapping.TensorDtypeMap(np_dtype, storage_dtype, name)[source]

TENSOR_TYPE_MAP

import pprint
from onnx.mapping import TENSOR_TYPE_MAP

pprint.pprint(TENSOR_TYPE_MAP)
{1: TensorDtypeMap(np_dtype=dtype('float32'), storage_dtype=1, name='TensorProto.FLOAT'),
 2: TensorDtypeMap(np_dtype=dtype('uint8'), storage_dtype=6, name='TensorProto.UINT8'),
 3: TensorDtypeMap(np_dtype=dtype('int8'), storage_dtype=6, name='TensorProto.INT8'),
 4: TensorDtypeMap(np_dtype=dtype('uint16'), storage_dtype=6, name='TensorProto.UINT16'),
 5: TensorDtypeMap(np_dtype=dtype('int16'), storage_dtype=6, name='TensorProto.INT16'),
 6: TensorDtypeMap(np_dtype=dtype('int32'), storage_dtype=6, name='TensorProto.INT32'),
 7: TensorDtypeMap(np_dtype=dtype('int64'), storage_dtype=7, name='TensorProto.INT64'),
 8: TensorDtypeMap(np_dtype=dtype('O'), storage_dtype=8, name='TensorProto.STRING'),
 9: TensorDtypeMap(np_dtype=dtype('bool'), storage_dtype=6, name='TensorProto.BOOL'),
 10: TensorDtypeMap(np_dtype=dtype('float16'), storage_dtype=4, name='TensorProto.FLOAT16'),
 11: TensorDtypeMap(np_dtype=dtype('float64'), storage_dtype=11, name='TensorProto.DOUBLE'),
 12: TensorDtypeMap(np_dtype=dtype('uint32'), storage_dtype=12, name='TensorProto.UINT32'),
 13: TensorDtypeMap(np_dtype=dtype('uint64'), storage_dtype=13, name='TensorProto.UINT64'),
 14: TensorDtypeMap(np_dtype=dtype('complex64'), storage_dtype=1, name='TensorProto.COMPLEX64'),
 15: TensorDtypeMap(np_dtype=dtype('complex128'), storage_dtype=11, name='TensorProto.COMPLEX128'),
 16: TensorDtypeMap(np_dtype=dtype('float32'), storage_dtype=4, name='TensorProto.BFLOAT16'),
 17: TensorDtypeMap(np_dtype=dtype('float32'), storage_dtype=2, name='TensorProto.FLOAT8E4M3FN'),
 18: TensorDtypeMap(np_dtype=dtype('float32'), storage_dtype=2, name='TensorProto.FLOAT8E4M3FNUZ'),
 19: TensorDtypeMap(np_dtype=dtype('float32'), storage_dtype=2, name='TensorProto.FLOAT8E5M2'),
 20: TensorDtypeMap(np_dtype=dtype('float32'), storage_dtype=2, name='TensorProto.FLOAT8E5M2FNUZ'),
 21: TensorDtypeMap(np_dtype=dtype('uint8'), storage_dtype=6, name='TensorProto.UINT4'),
 22: TensorDtypeMap(np_dtype=dtype('int8'), storage_dtype=6, name='TensorProto.INT4'),
 23: TensorDtypeMap(np_dtype=dtype('float32'), storage_dtype=2, name='TensorProto.FLOAT4E2M1')}