HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Ort::Custom::OrtLiteCustomOp Struct Reference

#include <onnxruntime_lite_custom_op.h>

+ Inheritance diagram for Ort::Custom::OrtLiteCustomOp:

Public Types

using ConstOptionalFloatTensor = std::optional< const Custom::Tensor< float > & >
 
using OptionalFloatTensor = std::optional< Custom::Tensor< float >>
 

Static Public Member Functions

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 > &)
 

Public Attributes

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_ = {}
 

Static Public Attributes

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

Definition at line 411 of file onnxruntime_lite_custom_op.h.

Member Typedef Documentation

Member Function Documentation

template<size_t ith_input, size_t ith_output, typename... Ts>
static std::enable_if<sizeof...(Ts) == 0, std::tuple<> >::type Ort::Custom::OrtLiteCustomOp::CreateTuple ( OrtKernelContext *  ,
ArgPtrs ,
size_t  ,
size_t  ,
const std::string  
)
inlinestatic

Definition at line 418 of file onnxruntime_lite_custom_op.h.

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 Ort::Custom::OrtLiteCustomOp::CreateTuple ( OrtKernelContext *  context,
ArgPtrs args,
size_t  num_input,
size_t  num_output,
const std::string ep 
)
inlinestatic

Definition at line 424 of file onnxruntime_lite_custom_op.h.

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 Ort::Custom::OrtLiteCustomOp::CreateTuple ( OrtKernelContext *  context,
ArgPtrs args,
size_t  num_input,
size_t  num_output,
const std::string ep 
)
inlinestatic

Definition at line 432 of file onnxruntime_lite_custom_op.h.

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 Ort::Custom::OrtLiteCustomOp::CreateTuple ( OrtKernelContext *  context,
ArgPtrs args,
size_t  num_input,
size_t  num_output,
const std::string ep 
)
inlinestatic

Definition at line 464 of file onnxruntime_lite_custom_op.h.

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 Ort::Custom::OrtLiteCustomOp::CreateTuple ( OrtKernelContext *  context,
ArgPtrs args,
size_t  num_input,
size_t  num_output,
const std::string ep 
)
inlinestatic

Definition at line 473 of file onnxruntime_lite_custom_op.h.

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 Ort::Custom::OrtLiteCustomOp::CreateTuple ( OrtKernelContext *  context,
ArgPtrs args,
size_t  num_input,
size_t  num_output,
const std::string ep 
)
inlinestatic

Definition at line 482 of file onnxruntime_lite_custom_op.h.

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 Ort::Custom::OrtLiteCustomOp::CreateTuple ( OrtKernelContext *  context,
ArgPtrs args,
size_t  num_input,
size_t  num_output,
const std::string ep 
)
inlinestatic

Definition at line 491 of file onnxruntime_lite_custom_op.h.

template<typename... Ts>
static std::enable_if<0 == sizeof...(Ts)>::type Ort::Custom::OrtLiteCustomOp::ParseArgs ( std::vector< ONNXTensorElementDataType > &  ,
std::vector< ONNXTensorElementDataType > &   
)
inlinestatic

Definition at line 654 of file onnxruntime_lite_custom_op.h.

Member Data Documentation

void* Ort::Custom::OrtLiteCustomOp::compute_fn_ = {}

Definition at line 878 of file onnxruntime_lite_custom_op.h.

void* Ort::Custom::OrtLiteCustomOp::compute_fn_return_status_ = {}

Definition at line 879 of file onnxruntime_lite_custom_op.h.

int Ort::Custom::OrtLiteCustomOp::end_ver_ = MAX_CUSTOM_OP_END_VER

Definition at line 876 of file onnxruntime_lite_custom_op.h.

const std::string Ort::Custom::OrtLiteCustomOp::execution_provider_

Definition at line 868 of file onnxruntime_lite_custom_op.h.

std::vector<ONNXTensorElementDataType> Ort::Custom::OrtLiteCustomOp::input_types_

Definition at line 870 of file onnxruntime_lite_custom_op.h.

const std::string Ort::Custom::OrtLiteCustomOp::op_name_

Definition at line 867 of file onnxruntime_lite_custom_op.h.

template<typename T , typename... Ts>
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-> Ort::Custom::OrtLiteCustomOp::output_types_[indice]
static

Definition at line 816 of file onnxruntime_lite_custom_op.h.

std::vector<ONNXTensorElementDataType> Ort::Custom::OrtLiteCustomOp::output_types_

Definition at line 871 of file onnxruntime_lite_custom_op.h.

ShapeInferFn Ort::Custom::OrtLiteCustomOp::shape_infer_fn_ = {}

Definition at line 873 of file onnxruntime_lite_custom_op.h.

int Ort::Custom::OrtLiteCustomOp::start_ver_ = 1

Definition at line 875 of file onnxruntime_lite_custom_op.h.


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