HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
onnxruntime::OpNodeProtoHelper< Impl_t > Class Template Reference

#include <op_node_proto_helper.h>

Public Member Functions

 OpNodeProtoHelper (const Impl_t *impl)
 
template<typename T >
MUST_USE_RESULT Status GetAttr (const std::string &name, T *value) const
 
template<typename T >
GetAttrOrDefault (const std::string &name, const T &default_value) const
 
template<typename T >
void GetAttrOrDefault (const std::string &name, T *value, const T &default_value) const
 
template<typename T >
MUST_USE_RESULT std::vector< T > GetAttrsOrDefault (const std::string &name, const std::vector< T > &default_value=std::vector< T >{}) const
 
template<typename T >
MUST_USE_RESULT Status GetAttrsAsSpan (const std::string &name, gsl::span< const T > &values) const
 Return a gsl::span that points to an array of primitive types held by AttributeProto This function allows to avoid copying big attributes locally into a kernel and operate on AttributeProto data directly. More...
 
MUST_USE_RESULT Status GetAttrs (const std::string &name, TensorShapeVector &out) const
 
MUST_USE_RESULT TensorShapeVector GetAttrsOrDefault (const std::string &name, const TensorShapeVector &default_value=TensorShapeVector{}) const
 
template<typename T >
MUST_USE_RESULT Status GetAttrs (const std::string &name, std::vector< T > &values) const
 
template<typename T >
MUST_USE_RESULT Status GetAttrs (const std::string &name, gsl::span< T > values) const
 
MUST_USE_RESULT Status GetAttrsStringRefs (const std::string &name, std::vector< std::reference_wrapper< const std::string >> &refs) const
 
uint32_t GetPrimitiveAttrElementCount (ONNX_NAMESPACE::AttributeProto_AttributeType type, const std::string &name) const noexcept
 
bool HasPrimitiveAttribute (ONNX_NAMESPACE::AttributeProto_AttributeType type, const std::string &name) const noexcept
 
uint32_t GetInputCount () const
 
uint32_t GetOutputCount () const
 
const ONNX_NAMESPACE::TypeProto * GetInputType (size_t index) const
 
const ONNX_NAMESPACE::TypeProto * GetOutputType (size_t index) const
 
const
ONNX_NAMESPACE::AttributeProto * 
TryGetAttribute (const std::string &name) const
 
const
ONNX_NAMESPACE::AttributeProto * 
GetAttribute (const std::string &name) const
 

Detailed Description

template<class Impl_t>
class onnxruntime::OpNodeProtoHelper< Impl_t >

A set of wrappers with common signatures for use with both OpKernelInfo (as its base class) and InferenceContext. Used by ABI kernels for both shape / type inference and kernel construction

Definition at line 37 of file op_node_proto_helper.h.

Constructor & Destructor Documentation

template<class Impl_t>
onnxruntime::OpNodeProtoHelper< Impl_t >::OpNodeProtoHelper ( const Impl_t *  impl)
inlineexplicit

Definition at line 39 of file op_node_proto_helper.h.

Member Function Documentation

template<class Impl_t>
template<typename T >
MUST_USE_RESULT Status onnxruntime::OpNodeProtoHelper< Impl_t >::GetAttr ( const std::string name,
T *  value 
) const

Get a single attribute Call this function for a required attribute or when a default value for an optional attribute is specified in the op schema

template<class Impl_t>
const ONNX_NAMESPACE::AttributeProto* onnxruntime::OpNodeProtoHelper< Impl_t >::GetAttribute ( const std::string name) const
inline

Definition at line 139 of file op_node_proto_helper.h.

template<class Impl_t>
template<typename T >
T onnxruntime::OpNodeProtoHelper< Impl_t >::GetAttrOrDefault ( const std::string name,
const T &  default_value 
) const
inline

Get a single attribute Call this function only when a default value for an optional attribute isn't specified in the op schema

Definition at line 53 of file op_node_proto_helper.h.

template<class Impl_t>
template<typename T >
void onnxruntime::OpNodeProtoHelper< Impl_t >::GetAttrOrDefault ( const std::string name,
T *  value,
const T &  default_value 
) const
inline

Get a single attribute Call this function only when a default value for an optional attribute isn't specified in the op schema

Definition at line 63 of file op_node_proto_helper.h.

template<class Impl_t>
MUST_USE_RESULT Status onnxruntime::OpNodeProtoHelper< Impl_t >::GetAttrs ( const std::string name,
TensorShapeVector out 
) const
template<class Impl_t>
template<typename T >
MUST_USE_RESULT Status onnxruntime::OpNodeProtoHelper< Impl_t >::GetAttrs ( const std::string name,
std::vector< T > &  values 
) const

Get repeated attributes

template<class Impl_t>
template<typename T >
MUST_USE_RESULT Status onnxruntime::OpNodeProtoHelper< Impl_t >::GetAttrs ( const std::string name,
gsl::span< T >  values 
) const
template<class Impl_t>
template<typename T >
MUST_USE_RESULT Status onnxruntime::OpNodeProtoHelper< Impl_t >::GetAttrsAsSpan ( const std::string name,
gsl::span< const T > &  values 
) const

Return a gsl::span that points to an array of primitive types held by AttributeProto This function allows to avoid copying big attributes locally into a kernel and operate on AttributeProto data directly.

Does not apply to strings, Tensors and Sparse Tensors that require special treatment.

Template Parameters
TPrimitive type contained in the array
Parameters
nameAttribute name
valuesAttribute data in a span, out parameter
Returns
Status
template<class Impl_t>
template<typename T >
MUST_USE_RESULT std::vector<T> onnxruntime::OpNodeProtoHelper< Impl_t >::GetAttrsOrDefault ( const std::string name,
const std::vector< T > &  default_value = std::vector<T>{} 
) const
inline

Get repeated attributes Call this function only when a default value for an optional attribute isn't specified in the op schema

Definition at line 73 of file op_node_proto_helper.h.

template<class Impl_t>
MUST_USE_RESULT TensorShapeVector onnxruntime::OpNodeProtoHelper< Impl_t >::GetAttrsOrDefault ( const std::string name,
const TensorShapeVector default_value = TensorShapeVector{} 
) const
inline

Definition at line 94 of file op_node_proto_helper.h.

template<class Impl_t>
MUST_USE_RESULT Status onnxruntime::OpNodeProtoHelper< Impl_t >::GetAttrsStringRefs ( const std::string name,
std::vector< std::reference_wrapper< const std::string >> &  refs 
) const
template<class Impl_t>
uint32_t onnxruntime::OpNodeProtoHelper< Impl_t >::GetInputCount ( ) const
inline

Definition at line 117 of file op_node_proto_helper.h.

template<class Impl_t>
const ONNX_NAMESPACE::TypeProto* onnxruntime::OpNodeProtoHelper< Impl_t >::GetInputType ( size_t  index) const
inline

Definition at line 125 of file op_node_proto_helper.h.

template<class Impl_t>
uint32_t onnxruntime::OpNodeProtoHelper< Impl_t >::GetOutputCount ( ) const
inline

Definition at line 121 of file op_node_proto_helper.h.

template<class Impl_t>
const ONNX_NAMESPACE::TypeProto* onnxruntime::OpNodeProtoHelper< Impl_t >::GetOutputType ( size_t  index) const
inline

Definition at line 129 of file op_node_proto_helper.h.

template<class Impl_t>
uint32_t onnxruntime::OpNodeProtoHelper< Impl_t >::GetPrimitiveAttrElementCount ( ONNX_NAMESPACE::AttributeProto_AttributeType  type,
const std::string name 
) const
noexcept
template<class Impl_t>
bool onnxruntime::OpNodeProtoHelper< Impl_t >::HasPrimitiveAttribute ( ONNX_NAMESPACE::AttributeProto_AttributeType  type,
const std::string name 
) const
noexcept
template<class Impl_t>
const ONNX_NAMESPACE::AttributeProto* onnxruntime::OpNodeProtoHelper< Impl_t >::TryGetAttribute ( const std::string name) const
inline

Definition at line 135 of file op_node_proto_helper.h.


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