HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
onnxruntime::DataTypeImpl Class Referenceabstract

Base class for MLDataType. More...

#include <data_types.h>

+ Inheritance diagram for onnxruntime::DataTypeImpl:

Public Types

enum  GeneralType {
  GeneralType::kInvalid = 0, GeneralType::kNonTensor = 1, GeneralType::kTensor = 2, GeneralType::kTensorSequence = 3,
  GeneralType::kSparseTensor = 4, GeneralType::kOptional = 5, GeneralType::kPrimitive = 6
}
 

Public Member Functions

virtual ~DataTypeImpl ()=default
 
virtual bool IsCompatible (const ONNX_NAMESPACE::TypeProto &type_proto) const =0
 this API will be used to check type compatibility at runtime More...
 
size_t Size () const
 
virtual DeleteFunc GetDeleteFunc () const =0
 
virtual const
ONNX_NAMESPACE::TypeProto * 
GetTypeProto () const =0
 Retrieves an instance of TypeProto for a given MLDataType. More...
 
bool IsTensorType () const
 
bool IsTensorSequenceType () const
 
bool IsSparseTensorType () const
 
bool IsOptionalType () const
 
bool IsNonTensorType () const
 
bool IsPrimitiveDataType () const
 
const TensorTypeBase * AsTensorType () const
 
const SequenceTensorTypeBase * AsSequenceTensorType () const
 
const SparseTensorTypeBase * AsSparseTensorType () const
 
const OptionalTypeBase * AsOptionalType () const
 
const NonTensorTypeBase * AsNonTensorType () const
 
const PrimitiveDataTypeBase * AsPrimitiveDataType () const
 

Static Public Member Functions

template<typename T >
static MLDataType GetType ()
 
template<typename elemT >
static MLDataType GetTensorType ()
 
template<typename elemT >
static MLDataType GetSequenceTensorType ()
 
template<typename elemT >
static MLDataType GetSparseTensorType ()
 
template<typename T , typename elemT >
static MLDataType GetOptionalType ()
 
static MLDataType TypeFromProto (const ONNX_NAMESPACE::TypeProto &proto)
 
static const TensorTypeBase * TensorTypeFromONNXEnum (int type)
 
static const
SequenceTensorTypeBase * 
SequenceTensorTypeFromONNXEnum (int type)
 
static const SparseTensorTypeBase * SparseTensorTypeFromONNXEnum (int type)
 
static const char * ToString (MLDataType type)
 
static std::vector< std::string > ToString (const std::vector< MLDataType > &types)
 
static void RegisterDataType (MLDataType)
 
static MLDataType GetDataType (const std::string &)
 
static const std::vector
< MLDataType > & 
AllTensorTypes ()
 
static const std::vector
< MLDataType > & 
AllTensorTypesIRv4 ()
 
static const std::vector
< MLDataType > & 
AllTensorTypesIRv9 ()
 
static const std::vector
< MLDataType > & 
AllFixedSizeTensorTypes ()
 
static const std::vector
< MLDataType > & 
AllFixedSizeTensorTypesIRv4 ()
 
static const std::vector
< MLDataType > & 
AllFixedSizeTensorTypesIRv9 ()
 
static const std::vector
< MLDataType > & 
AllSequenceTensorTypes ()
 
static const std::vector
< MLDataType > & 
AllSequenceTensorTypesIRv4 ()
 
static const std::vector
< MLDataType > & 
AllSequenceTensorTypesIRv9 ()
 
static const std::vector
< MLDataType > & 
AllFixedSizeSequenceTensorTypes ()
 
static const std::vector
< MLDataType > & 
AllFixedSizeSequenceTensorTypesIRv4 ()
 
static const std::vector
< MLDataType > & 
AllFixedSizeSequenceTensorTypesIRv9 ()
 
static const std::vector
< MLDataType > & 
AllNumericTensorTypes ()
 
static const std::vector
< MLDataType > & 
AllNumericTensorTypesIRv4 ()
 
static const std::vector
< MLDataType > & 
AllNumericTensorTypesIRv9 ()
 
static const std::vector
< MLDataType > & 
AllIEEEFloatTensorTypes ()
 
static const std::vector
< MLDataType > & 
AllTensorAndSequenceTensorTypes ()
 
static const std::vector
< MLDataType > & 
AllTensorAndSequenceTensorTypesIRv4 ()
 
static const std::vector
< MLDataType > & 
AllTensorAndSequenceTensorTypesIRv9 ()
 
static const std::vector
< MLDataType > & 
AllOptionalAndTensorAndSequenceTensorTypes ()
 
static const std::vector
< MLDataType > & 
AllOptionalAndTensorAndSequenceTensorTypesIRv4 ()
 
static const std::vector
< MLDataType > & 
AllOptionalAndTensorAndSequenceTensorTypesIRv9 ()
 
static const std::vector
< MLDataType > & 
AllFixedSizeTensorAndSequenceTensorTypes ()
 
static const std::vector
< MLDataType > & 
AllFixedSizeTensorAndSequenceTensorTypesIRv4 ()
 
static const std::vector
< MLDataType > & 
AllFixedSizeTensorAndSequenceTensorTypesIRv9 ()
 
static const std::vector
< MLDataType > & 
AllOptionalTypes ()
 
static const std::vector
< MLDataType > & 
AllOptionalTypesIRv4 ()
 
static const std::vector
< MLDataType > & 
AllOptionalTypesIRv9 ()
 
static const std::vector
< MLDataType > & 
AllTensorAndSequenceTensorAndOptionalTypes ()
 
static const std::vector
< MLDataType > & 
AllTensorAndSequenceTensorAndOptionalTypesIRv4 ()
 
static const std::vector
< MLDataType > & 
AllTensorAndSequenceTensorAndOptionalTypesIRv9 ()
 

Public Attributes

const GeneralType type_
 
const size_t size_
 

Protected Member Functions

 DataTypeImpl (GeneralType type, size_t size)
 

Detailed Description

Base class for MLDataType.

Definition at line 77 of file data_types.h.

Member Enumeration Documentation

Enumerator
kInvalid 
kNonTensor 
kTensor 
kTensorSequence 
kSparseTensor 
kOptional 
kPrimitive 

Definition at line 79 of file data_types.h.

Constructor & Destructor Documentation

onnxruntime::DataTypeImpl::DataTypeImpl ( GeneralType  type,
size_t  size 
)
inlineprotected

Definition at line 93 of file data_types.h.

virtual onnxruntime::DataTypeImpl::~DataTypeImpl ( )
virtualdefault

Member Function Documentation

static const std::vector<MLDataType>& onnxruntime::DataTypeImpl::AllFixedSizeSequenceTensorTypes ( )
static
static const std::vector<MLDataType>& onnxruntime::DataTypeImpl::AllFixedSizeSequenceTensorTypesIRv4 ( )
static
static const std::vector<MLDataType>& onnxruntime::DataTypeImpl::AllFixedSizeSequenceTensorTypesIRv9 ( )
static
static const std::vector<MLDataType>& onnxruntime::DataTypeImpl::AllFixedSizeTensorAndSequenceTensorTypes ( )
static
static const std::vector<MLDataType>& onnxruntime::DataTypeImpl::AllFixedSizeTensorAndSequenceTensorTypesIRv4 ( )
static
static const std::vector<MLDataType>& onnxruntime::DataTypeImpl::AllFixedSizeTensorAndSequenceTensorTypesIRv9 ( )
static
static const std::vector<MLDataType>& onnxruntime::DataTypeImpl::AllFixedSizeTensorTypes ( )
static
static const std::vector<MLDataType>& onnxruntime::DataTypeImpl::AllFixedSizeTensorTypesIRv4 ( )
static
static const std::vector<MLDataType>& onnxruntime::DataTypeImpl::AllFixedSizeTensorTypesIRv9 ( )
static
static const std::vector<MLDataType>& onnxruntime::DataTypeImpl::AllIEEEFloatTensorTypes ( )
static
static const std::vector<MLDataType>& onnxruntime::DataTypeImpl::AllNumericTensorTypes ( )
static
static const std::vector<MLDataType>& onnxruntime::DataTypeImpl::AllNumericTensorTypesIRv4 ( )
static
static const std::vector<MLDataType>& onnxruntime::DataTypeImpl::AllNumericTensorTypesIRv9 ( )
static
static const std::vector<MLDataType>& onnxruntime::DataTypeImpl::AllOptionalAndTensorAndSequenceTensorTypes ( )
static
static const std::vector<MLDataType>& onnxruntime::DataTypeImpl::AllOptionalAndTensorAndSequenceTensorTypesIRv4 ( )
static
static const std::vector<MLDataType>& onnxruntime::DataTypeImpl::AllOptionalAndTensorAndSequenceTensorTypesIRv9 ( )
static
static const std::vector<MLDataType>& onnxruntime::DataTypeImpl::AllOptionalTypes ( )
static
static const std::vector<MLDataType>& onnxruntime::DataTypeImpl::AllOptionalTypesIRv4 ( )
static
static const std::vector<MLDataType>& onnxruntime::DataTypeImpl::AllOptionalTypesIRv9 ( )
static
static const std::vector<MLDataType>& onnxruntime::DataTypeImpl::AllSequenceTensorTypes ( )
static
static const std::vector<MLDataType>& onnxruntime::DataTypeImpl::AllSequenceTensorTypesIRv4 ( )
static
static const std::vector<MLDataType>& onnxruntime::DataTypeImpl::AllSequenceTensorTypesIRv9 ( )
static
static const std::vector<MLDataType>& onnxruntime::DataTypeImpl::AllTensorAndSequenceTensorAndOptionalTypes ( )
static
static const std::vector<MLDataType>& onnxruntime::DataTypeImpl::AllTensorAndSequenceTensorAndOptionalTypesIRv4 ( )
static
static const std::vector<MLDataType>& onnxruntime::DataTypeImpl::AllTensorAndSequenceTensorAndOptionalTypesIRv9 ( )
static
static const std::vector<MLDataType>& onnxruntime::DataTypeImpl::AllTensorAndSequenceTensorTypes ( )
static
static const std::vector<MLDataType>& onnxruntime::DataTypeImpl::AllTensorAndSequenceTensorTypesIRv4 ( )
static
static const std::vector<MLDataType>& onnxruntime::DataTypeImpl::AllTensorAndSequenceTensorTypesIRv9 ( )
static
static const std::vector<MLDataType>& onnxruntime::DataTypeImpl::AllTensorTypes ( )
static
static const std::vector<MLDataType>& onnxruntime::DataTypeImpl::AllTensorTypesIRv4 ( )
static
static const std::vector<MLDataType>& onnxruntime::DataTypeImpl::AllTensorTypesIRv9 ( )
static
const NonTensorTypeBase * onnxruntime::DataTypeImpl::AsNonTensorType ( ) const
inline

Definition at line 1006 of file data_types.h.

const OptionalTypeBase * onnxruntime::DataTypeImpl::AsOptionalType ( ) const
inline

Definition at line 1001 of file data_types.h.

const PrimitiveDataTypeBase * onnxruntime::DataTypeImpl::AsPrimitiveDataType ( ) const
inline

Definition at line 1010 of file data_types.h.

const SequenceTensorTypeBase * onnxruntime::DataTypeImpl::AsSequenceTensorType ( ) const
inline

Definition at line 990 of file data_types.h.

const SparseTensorTypeBase * onnxruntime::DataTypeImpl::AsSparseTensorType ( ) const
inline

Definition at line 995 of file data_types.h.

const TensorTypeBase * onnxruntime::DataTypeImpl::AsTensorType ( ) const
inline

Definition at line 986 of file data_types.h.

static MLDataType onnxruntime::DataTypeImpl::GetDataType ( const std::string &  )
static
template<typename T , typename elemT >
static MLDataType onnxruntime::DataTypeImpl::GetOptionalType ( )
static
template<typename elemT >
static MLDataType onnxruntime::DataTypeImpl::GetSequenceTensorType ( )
static
template<typename elemT >
static MLDataType onnxruntime::DataTypeImpl::GetSparseTensorType ( )
static
template<typename elemT >
static MLDataType onnxruntime::DataTypeImpl::GetTensorType ( )
static
template<typename T >
static MLDataType onnxruntime::DataTypeImpl::GetType ( )
static
virtual const ONNX_NAMESPACE::TypeProto* onnxruntime::DataTypeImpl::GetTypeProto ( ) const
pure virtual

Retrieves an instance of TypeProto for a given MLDataType.

Returns
optional TypeProto. Only ONNX types has type proto, non-ONNX types will return nullptr.

Implemented in onnxruntime::PrimitiveDataTypeBase, onnxruntime::SequenceTensorTypeBase, onnxruntime::NonTensorTypeBase, onnxruntime::OptionalTypeBase, onnxruntime::SparseTensorTypeBase, and onnxruntime::TensorTypeBase.

virtual bool onnxruntime::DataTypeImpl::IsCompatible ( const ONNX_NAMESPACE::TypeProto &  type_proto) const
pure virtual

this API will be used to check type compatibility at runtime

Parameters
type_protoa TypeProto instance that is constructed for a specific type will be checked against a TypeProto instance contained within a corresponding MLDataType instance.

Implemented in onnxruntime::PrimitiveDataTypeBase, onnxruntime::OpaqueType< T, D, N >, onnxruntime::SequenceTensorTypeBase, onnxruntime::SequenceType< CPPType >, onnxruntime::MapType< CPPType >, onnxruntime::OptionalTypeBase, onnxruntime::SparseTensorTypeBase, and onnxruntime::TensorTypeBase.

bool onnxruntime::DataTypeImpl::IsNonTensorType ( ) const
inline

Definition at line 135 of file data_types.h.

bool onnxruntime::DataTypeImpl::IsOptionalType ( ) const
inline

Definition at line 131 of file data_types.h.

bool onnxruntime::DataTypeImpl::IsPrimitiveDataType ( ) const
inline

Definition at line 139 of file data_types.h.

bool onnxruntime::DataTypeImpl::IsSparseTensorType ( ) const
inline

Definition at line 127 of file data_types.h.

bool onnxruntime::DataTypeImpl::IsTensorSequenceType ( ) const
inline

Definition at line 123 of file data_types.h.

bool onnxruntime::DataTypeImpl::IsTensorType ( ) const
inline

Definition at line 119 of file data_types.h.

static void onnxruntime::DataTypeImpl::RegisterDataType ( MLDataType  )
static
static const SequenceTensorTypeBase* onnxruntime::DataTypeImpl::SequenceTensorTypeFromONNXEnum ( int  type)
static
size_t onnxruntime::DataTypeImpl::Size ( ) const
inline

Definition at line 107 of file data_types.h.

static const SparseTensorTypeBase* onnxruntime::DataTypeImpl::SparseTensorTypeFromONNXEnum ( int  type)
static
static const TensorTypeBase* onnxruntime::DataTypeImpl::TensorTypeFromONNXEnum ( int  type)
static
static const char* onnxruntime::DataTypeImpl::ToString ( MLDataType  type)
static
static std::vector<std::string> onnxruntime::DataTypeImpl::ToString ( const std::vector< MLDataType > &  types)
static
static MLDataType onnxruntime::DataTypeImpl::TypeFromProto ( const ONNX_NAMESPACE::TypeProto &  proto)
static

Convert an ONNX TypeProto to onnxruntime DataTypeImpl. However, this conversion is lossy. Don't try to use 'this->GetTypeProto()' converting it back. Even though GetTypeProto() will not have the original information, it will still have enough to correctly map to MLDataType.

Parameters
proto

Member Data Documentation

const size_t onnxruntime::DataTypeImpl::size_

Definition at line 90 of file data_types.h.

const GeneralType onnxruntime::DataTypeImpl::type_

Definition at line 89 of file data_types.h.


The documentation for this class was generated from the following file: