HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Ort::Custom::OrtLiteCustomStruct< CustomOp > Struct Template Reference

#include <onnxruntime_lite_custom_op.h>

+ Inheritance diagram for Ort::Custom::OrtLiteCustomStruct< CustomOp >:

Classes

struct  Kernel
 

Public Types

template<typename... Args>
using CustomComputeFn = void(CustomOp::*)(Args...)
 
template<typename... Args>
using CustomComputeFnReturnStatus = Status(CustomOp::*)(Args...)
 
using MyType = OrtLiteCustomStruct< CustomOp >
 
- Public Types inherited from Ort::Custom::OrtLiteCustomOp
using ConstOptionalFloatTensor = std::optional< const Custom::Tensor< float > & >
 
using OptionalFloatTensor = std::optional< Custom::Tensor< float >>
 

Public Member Functions

 OrtLiteCustomStruct (const char *op_name, const char *execution_provider, int start_ver=1, int end_ver=MAX_CUSTOM_OP_END_VER)
 
 SetShapeInfer (0)
 
template<typename... Args>
void SetCompute (CustomComputeFn< Args...>)
 
template<typename... Args>
void SetCompute (CustomComputeFnReturnStatus< Args...>)
 
template<typename C >
void SetShapeInfer (...)
 

Public Attributes

 start_ver
 
 end_ver
 
template<typename C >
decltype(&C::InferOutputShape) SetShapeInfer (decltype(&C::InferOutputShape))
 
- Public Attributes inherited from Ort::Custom::OrtLiteCustomOp
const std::string op_name_
 
const std::string execution_provider_
 
std::vector
< ONNXTensorElementDataType > 
input_types_
 
std::vector
< ONNXTensorElementDataType > 
output_types_
 
ShapeInferFn shape_infer_fn_ = {}
 
int start_ver_ = 1
 
int end_ver_ = MAX_CUSTOM_OP_END_VER
 
voidcompute_fn_ = {}
 
voidcompute_fn_return_status_ = {}
 

Additional Inherited Members

- Static Public Member Functions inherited from Ort::Custom::OrtLiteCustomOp
template<size_t ith_input, size_t ith_output, typename... Ts>
static std::enable_if
< sizeof...(Ts)==0, std::tuple
<> >::type 
CreateTuple (OrtKernelContext *, ArgPtrs &, size_t, size_t, const std::string &)
 
template<size_t ith_input, size_t ith_output, typename T , typename... Ts>
static std::enable_if
< std::is_same< T,
OrtKernelContext * >::value,
std::tuple< T, Ts...> >::type 
CreateTuple (OrtKernelContext *context, ArgPtrs &args, size_t num_input, size_t num_output, const std::string &ep)
 
template<size_t ith_input, size_t ith_output, typename T , typename... Ts>
static std::enable_if
< std::is_same< T,
OrtKernelContext & >::value,
std::tuple< T, Ts...> >::type 
CreateTuple (OrtKernelContext *context, ArgPtrs &args, size_t num_input, size_t num_output, const std::string &ep)
 
template<size_t ith_input, size_t ith_output, typename T , typename... Ts>
static std::enable_if
< std::is_same< T, const
TensorArray * >::value,
std::tuple< T, Ts...> >::type 
CreateTuple (OrtKernelContext *context, ArgPtrs &args, size_t num_input, size_t num_output, const std::string &ep)
 
template<size_t ith_input, size_t ith_output, typename T , typename... Ts>
static std::enable_if
< std::is_same< T, const
TensorArray & >::value,
std::tuple< T, Ts...> >::type 
CreateTuple (OrtKernelContext *context, ArgPtrs &args, size_t num_input, size_t num_output, const std::string &ep)
 
template<size_t ith_input, size_t ith_output, typename T , typename... Ts>
static std::enable_if
< std::is_same< T, TensorArray * >
::value, std::tuple< T, Ts...>
>::type 
CreateTuple (OrtKernelContext *context, ArgPtrs &args, size_t num_input, size_t num_output, const std::string &ep)
 
template<size_t ith_input, size_t ith_output, typename T , typename... Ts>
static std::enable_if
< std::is_same< T, TensorArray & >
::value, std::tuple< T, Ts...>
>::type 
CreateTuple (OrtKernelContext *context, ArgPtrs &args, size_t num_input, size_t num_output, const std::string &ep)
 
template<typename... Ts>
static std::enable_if
< 0==sizeof...(Ts)>::type 
ParseArgs (std::vector< ONNXTensorElementDataType > &, std::vector< ONNXTensorElementDataType > &)
 
- Static Public Attributes inherited from Ort::Custom::OrtLiteCustomOp
template<typename T , typename... Ts>
static std::enable_if
< 0<=sizeof...(Ts)&&std::is_same
< T, OrtKernelContext * >
::value >::type ParseArgs(std::vector
< ONNXTensorElementDataType >
&input_types, std::vector
< ONNXTensorElementDataType >
&output_types){ParseArgs
< Ts...>input_types,
output_types);}template
< typename T, typename...Ts >
static typename
std::enable_if< 0<=sizeof...(Ts)&&std::is_same
< T, OrtKernelContext & >
::value >::type ParseArgs(std::vector
< ONNXTensorElementDataType >
&input_types, std::vector
< ONNXTensorElementDataType >
&output_types){ParseArgs
< Ts...>input_types,
output_types);}template
< typename T, typename...Ts >
static typename
std::enable_if< 0<=sizeof...(Ts)&&std::is_same
< T, const TensorArray & >
::value >::type ParseArgs(std::vector
< ONNXTensorElementDataType >
&input_types, std::vector
< ONNXTensorElementDataType >
&output_types){input_types.push_back(ONNX_TENSOR_ELEMENT_DATA_TYPE_UNDEFINED);ParseArgs
< Ts...>input_types,
output_types);}template
< typename T, typename...Ts >
static typename
std::enable_if< 0<=sizeof...(Ts)&&std::is_same
< T, const TensorArray * >
::value >::type ParseArgs(std::vector
< ONNXTensorElementDataType >
&input_types, std::vector
< ONNXTensorElementDataType >
&output_types){input_types.push_back(ONNX_TENSOR_ELEMENT_DATA_TYPE_UNDEFINED);ParseArgs
< Ts...>input_types,
output_types);}template
< typename T, typename...Ts >
static typename
std::enable_if< 0<=sizeof...(Ts)&&std::is_same
< T, TensorArray & >::value >
::type ParseArgs(std::vector
< ONNXTensorElementDataType >
&input_types, std::vector
< ONNXTensorElementDataType >
&output_types){output_types.push_back(ONNX_TENSOR_ELEMENT_DATA_TYPE_UNDEFINED);ParseArgs
< Ts...>input_types,
output_types);}template
< typename T, typename...Ts >
static typename
std::enable_if< 0<=sizeof...(Ts)&&std::is_same
< T, TensorArray * >::value >
::type ParseArgs(std::vector
< ONNXTensorElementDataType >
&input_types, std::vector
< ONNXTensorElementDataType >
&output_types){output_types.push_back(ONNX_TENSOR_ELEMENT_DATA_TYPE_UNDEFINED);ParseArgs
< Ts...>input_types,
output_types);}#define
PARSE_INPUT_BASE(pack_type,
onnx_type)#define PARSE_INPUT(data_type,
onnx_type)#define PARSE_OUTPUT(data_type,
onnx_type)#define PARSE_ARGS(data_type,
onnx_type) PARSE_ARGS(std::string_view,
ONNX_TENSOR_ELEMENT_DATA_TYPE_STRING)
OrtLiteCustomOp(const char
*op_name, const char
*execution_provider,
ShapeInferFn shape_infer_fn,
int start_ver=1, int end_ver=MAX_CUSTOM_OP_END_VER):op_name_(op_name),
execution_provider_(execution_provider),
shape_infer_fn_(shape_infer_fn),
start_ver_(start_ver),
end_ver_(end_ver){OrtCustomOp::version=ORT_API_VERSION;OrtCustomOp::GetName=[](const
OrtCustomOp *op){return
static_cast< const
OrtLiteCustomOp * >op) ->
op_name_.c_str();};OrtCustomOp::GetExecutionProviderType=[](const
OrtCustomOp *op){return((OrtLiteCustomOp
*) op) ->
execution_provider_.c_str();};OrtCustomOp::GetInputMemoryType=[](const
OrtCustomOp *, size_t){return
OrtMemTypeDefault;};OrtCustomOp::GetInputTypeCount=[](const
OrtCustomOp *op){auto self=reinterpret_cast
< const OrtLiteCustomOp * >op);return
self->input_types_.size();};OrtCustomOp::GetInputType=[](const
OrtCustomOp *op, size_t indice){auto
self=reinterpret_cast< const
OrtLiteCustomOp * >op);return
self->input_types_[indice];};OrtCustomOp::GetOutputTypeCount=[](const
OrtCustomOp *op){auto self=reinterpret_cast
< const OrtLiteCustomOp * >op);return
self->output_types_.size();};OrtCustomOp::GetOutputType=[](const
OrtCustomOp *op, size_t indice){auto
self=reinterpret_cast< const
OrtLiteCustomOp * >op);return
self-> 
output_types_ [indice]
 

Detailed Description

template<typename CustomOp>
struct Ort::Custom::OrtLiteCustomStruct< CustomOp >

Definition at line 1004 of file onnxruntime_lite_custom_op.h.

Member Typedef Documentation

template<typename CustomOp >
template<typename... Args>
using Ort::Custom::OrtLiteCustomStruct< CustomOp >::CustomComputeFn = void (CustomOp::*)(Args...)

Definition at line 1006 of file onnxruntime_lite_custom_op.h.

template<typename CustomOp >
template<typename... Args>
using Ort::Custom::OrtLiteCustomStruct< CustomOp >::CustomComputeFnReturnStatus = Status (CustomOp::*)(Args...)

Definition at line 1009 of file onnxruntime_lite_custom_op.h.

template<typename CustomOp >
using Ort::Custom::OrtLiteCustomStruct< CustomOp >::MyType = OrtLiteCustomStruct<CustomOp>

Definition at line 1011 of file onnxruntime_lite_custom_op.h.

Constructor & Destructor Documentation

template<typename CustomOp >
Ort::Custom::OrtLiteCustomStruct< CustomOp >::OrtLiteCustomStruct ( const char *  op_name,
const char *  execution_provider,
int  start_ver = 1,
int  end_ver = MAX_CUSTOM_OP_END_VER 
)
inline

Definition at line 1020 of file onnxruntime_lite_custom_op.h.

Member Function Documentation

template<typename CustomOp >
template<typename... Args>
void Ort::Custom::OrtLiteCustomStruct< CustomOp >::SetCompute ( CustomComputeFn< Args...>  )
inline

Definition at line 1044 of file onnxruntime_lite_custom_op.h.

template<typename CustomOp >
template<typename... Args>
void Ort::Custom::OrtLiteCustomStruct< CustomOp >::SetCompute ( CustomComputeFnReturnStatus< Args...>  )
inline

Definition at line 1055 of file onnxruntime_lite_custom_op.h.

template<typename CustomOp >
Ort::Custom::OrtLiteCustomStruct< CustomOp >::SetShapeInfer ( )
template<typename CustomOp >
template<typename C >
void Ort::Custom::OrtLiteCustomStruct< CustomOp >::SetShapeInfer (   ...)
inline

Definition at line 1075 of file onnxruntime_lite_custom_op.h.

Member Data Documentation

template<typename CustomOp >
Ort::Custom::OrtLiteCustomStruct< CustomOp >::end_ver
Initial value:
{
SetCompute(&CustomOp::Compute)

Definition at line 1023 of file onnxruntime_lite_custom_op.h.

template<typename CustomOp >
template<typename C >
decltype(&C::InferOutputShape) Ort::Custom::OrtLiteCustomStruct< CustomOp >::SetShapeInfer(decltype(&C::InferOutputShape))
inline

Definition at line 1066 of file onnxruntime_lite_custom_op.h.

template<typename CustomOp >
Ort::Custom::OrtLiteCustomStruct< CustomOp >::start_ver

Definition at line 1023 of file onnxruntime_lite_custom_op.h.


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