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 TensorTypeBaseAsTensorType () const
 
const SequenceTensorTypeBaseAsSequenceTensorType () const
 
const SparseTensorTypeBaseAsSparseTensorType () const
 
const OptionalTypeBaseAsOptionalType () const
 
const NonTensorTypeBaseAsNonTensorType () const
 
const PrimitiveDataTypeBaseAsPrimitiveDataType () 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 TensorTypeBaseTensorTypeFromONNXEnum (int type)
 
static const
SequenceTensorTypeBase
SequenceTensorTypeFromONNXEnum (int type)
 
static const SparseTensorTypeBaseSparseTensorTypeFromONNXEnum (int type)
 
static const char * ToString (MLDataType type)
 
static std::vector< std::stringToString (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 > & 
AllFixedSizeTensorTypes ()
 
static const std::vector
< MLDataType > & 
AllSequenceTensorTypes ()
 
static const std::vector
< MLDataType > & 
AllFixedSizeSequenceTensorTypes ()
 
static const std::vector
< MLDataType > & 
AllNumericTensorTypes ()
 
static const std::vector
< MLDataType > & 
AllIEEEFloatTensorTypes ()
 
static const std::vector
< MLDataType > & 
AllFixedSizeTensorExceptHalfTypes ()
 
static const std::vector
< MLDataType > & 
AllIEEEFloatTensorExceptHalfTypes ()
 
static const std::vector
< MLDataType > & 
AllTensorAndSequenceTensorTypes ()
 
static const std::vector
< MLDataType > & 
AllFixedSizeTensorAndSequenceTensorTypes ()
 
static const std::vector
< MLDataType > & 
AllOptionalTypes ()
 
static const std::vector
< MLDataType > & 
AllTensorAndSequenceTensorAndOptionalTypes ()
 

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 81 of file data_types.h.

Member Enumeration Documentation

Enumerator
kInvalid 
kNonTensor 
kTensor 
kTensorSequence 
kSparseTensor 
kOptional 
kPrimitive 

Definition at line 83 of file data_types.h.

Constructor & Destructor Documentation

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

Definition at line 97 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::AllFixedSizeTensorAndSequenceTensorTypes ( )
static
static const std::vector<MLDataType>& onnxruntime::DataTypeImpl::AllFixedSizeTensorExceptHalfTypes ( )
static
static const std::vector<MLDataType>& onnxruntime::DataTypeImpl::AllFixedSizeTensorTypes ( )
static
static const std::vector<MLDataType>& onnxruntime::DataTypeImpl::AllIEEEFloatTensorExceptHalfTypes ( )
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::AllOptionalTypes ( )
static
static const std::vector<MLDataType>& onnxruntime::DataTypeImpl::AllSequenceTensorTypes ( )
static
static const std::vector<MLDataType>& onnxruntime::DataTypeImpl::AllTensorAndSequenceTensorAndOptionalTypes ( )
static
static const std::vector<MLDataType>& onnxruntime::DataTypeImpl::AllTensorAndSequenceTensorTypes ( )
static
static const std::vector<MLDataType>& onnxruntime::DataTypeImpl::AllTensorTypes ( )
static
const NonTensorTypeBase * onnxruntime::DataTypeImpl::AsNonTensorType ( ) const
inline

Definition at line 958 of file data_types.h.

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

Definition at line 953 of file data_types.h.

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

Definition at line 962 of file data_types.h.

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

Definition at line 942 of file data_types.h.

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

Definition at line 947 of file data_types.h.

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

Definition at line 938 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 139 of file data_types.h.

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

Definition at line 135 of file data_types.h.

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

Definition at line 143 of file data_types.h.

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

Definition at line 131 of file data_types.h.

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

Definition at line 127 of file data_types.h.

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

Definition at line 123 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 111 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 94 of file data_types.h.

const GeneralType onnxruntime::DataTypeImpl::type_

Definition at line 93 of file data_types.h.


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