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 >
Status GetAttr (const std::string &name, T *value) const
 
template<typename T >
GetAttr (const std::string &name) 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 >
std::vector< T > GetAttrsOrDefault (const std::string &name, const std::vector< T > &default_value={}) const
 
template<typename T >
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...
 
Status GetAttrs (const std::string &name, TensorShapeVector &out) const
 
TensorShapeVector GetAttrsOrDefault (const std::string &name, const TensorShapeVector &default_value={}) const
 
template<typename T >
Status GetAttrs (const std::string &name, std::vector< T > &values) const
 
template<typename T >
Status GetAttrs (const std::string &name, gsl::span< T > values) const
 
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 23 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 25 of file op_node_proto_helper.h.

Member Function Documentation

template<class Impl_t>
template<typename T >
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>
template<typename T >
T onnxruntime::OpNodeProtoHelper< Impl_t >::GetAttr ( const std::string name) const
inline

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 Throws if an attribute with the specified type doesn't exist

Definition at line 40 of file op_node_proto_helper.h.

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 51 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 61 of file op_node_proto_helper.h.

template<class Impl_t>
Status onnxruntime::OpNodeProtoHelper< Impl_t >::GetAttrs ( const std::string name,
TensorShapeVector out 
) const
template<class Impl_t>
template<typename T >
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 >
Status onnxruntime::OpNodeProtoHelper< Impl_t >::GetAttrs ( const std::string name,
gsl::span< T >  values 
) const
template<class Impl_t>
template<typename T >
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 >
std::vector<T> onnxruntime::OpNodeProtoHelper< Impl_t >::GetAttrsOrDefault ( const std::string name,
const std::vector< T > &  default_value = {} 
) 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 71 of file op_node_proto_helper.h.

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

Definition at line 93 of file op_node_proto_helper.h.

template<class Impl_t>
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: