HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
op_kernel.h File Reference
#include "boost/mp11.hpp"
#include "core/framework/prepacked_weights_container.h"
#include <functional>
#include "core/common/exceptions.h"
#include "core/common/logging/logging.h"
#include "core/common/status.h"
#include "core/framework/execution_provider.h"
#include "core/framework/kernel_def_builder.h"
#include "core/framework/op_kernel_info.h"
#include "core/framework/op_node_proto_helper.h"
#include "core/framework/ort_value.h"
#include "core/framework/sparse_tensor.h"
#include "core/framework/tensor.h"
#include "core/graph/constants.h"
#include "core/graph/graph_viewer.h"
#include "core/graph/onnx_protobuf.h"
#include "core/common/gsl.h"
#include "core/framework/op_kernel_context.h"
+ Include dependency graph for op_kernel.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  onnxruntime::OpKernel
 
struct  onnxruntime::KernelCreateInfo
 
struct  onnxruntime::BuildKernelDefConstraintsImpl< Types >
 
struct  onnxruntime::BuildKernelDefSparseConstraintsImpl< Types >
 

Namespaces

 onnxruntime
 
 onnxruntime::ml
 
 onnxruntime::contrib
 
 onnxruntime::contrib::cuda
 
 onnxruntime::contrib::js
 
 onnxruntime::contrib::rocm
 
 onnxruntime::contrib::snpe
 

Macros

#define ONNX_OPERATOR_KERNEL_CLASS_NAME(provider, domain, ver, name)   provider##_##name##_##domain##_ver##ver
 
#define ONNX_CPU_OPERATOR_KERNEL(name, ver, builder,...)   ONNX_OPERATOR_KERNEL_EX(name, kOnnxDomain, ver, kCpuExecutionProvider, builder, __VA_ARGS__)
 
#define ONNX_CPU_OPERATOR_ML_KERNEL(name, ver, builder,...)   ONNX_OPERATOR_KERNEL_EX(name, kMLDomain, ver, kCpuExecutionProvider, builder, __VA_ARGS__)
 
#define ONNX_CPU_OPERATOR_MS_KERNEL(name, ver, builder,...)   ONNX_OPERATOR_KERNEL_EX(name, kMSDomain, ver, kCpuExecutionProvider, builder, __VA_ARGS__)
 
#define ONNX_OPERATOR_KERNEL_EX(name, domain, ver, provider, builder,...)
 
#define ONNX_OPERATOR_VERSIONED_KERNEL_CLASS_NAME(provider, domain, startver, endver, name)   provider##_##name##_##domain##_ver##startver##_##endver
 
#define ONNX_CPU_OPERATOR_VERSIONED_KERNEL(name, startver, endver, builder,...)   ONNX_OPERATOR_VERSIONED_KERNEL_EX(name, kOnnxDomain, startver, endver, kCpuExecutionProvider, builder, __VA_ARGS__)
 
#define ONNX_CPU_OPERATOR_VERSIONED_ML_KERNEL(name, startver, endver, builder,...)   ONNX_OPERATOR_VERSIONED_KERNEL_EX(name, kMLDomain, startver, endver, kCpuExecutionProvider, builder, __VA_ARGS__)
 
#define ONNX_OPERATOR_VERSIONED_KERNEL_EX(name, domain, startver, endver, provider, builder,...)
 
#define ONNX_OPERATOR_TYPED_KERNEL_CLASS_NAME(provider, domain, ver, type, name)   provider##_##name##_##domain##_ver##ver##_##type
 
#define ONNX_CPU_OPERATOR_TYPED_KERNEL(name, ver, type, builder,...)   ONNX_OPERATOR_TYPED_KERNEL_EX(name, kOnnxDomain, ver, type, kCpuExecutionProvider, builder, __VA_ARGS__)
 
#define ONNX_CPU_OPERATOR_TYPED_ML_KERNEL(name, ver, type, builder,...)   ONNX_OPERATOR_TYPED_KERNEL_EX(name, kMLDomain, ver, type, kCpuExecutionProvider, builder, __VA_ARGS__)
 
#define ONNX_CPU_OPERATOR_TYPED_MS_KERNEL(name, ver, type, builder,...)   ONNX_OPERATOR_TYPED_KERNEL_EX(name, kMSDomain, ver, type, kCpuExecutionProvider, builder, __VA_ARGS__)
 
#define ONNX_OPERATOR_TYPED_KERNEL_EX(name, domain, ver, type, provider, builder,...)
 
#define ONNX_OPERATOR_TWO_TYPED_KERNEL_CLASS_NAME(provider, domain, ver, type1, type2, name)   provider##_##name##_##domain##_ver##ver##_##type1##_##type2
 
#define ONNX_OPERATOR_TWO_TYPED_KERNEL_EX(name, domain, ver, type1, type2, provider, builder,...)
 
#define ONNX_OPERATOR_VERSIONED_TYPED_KERNEL_CLASS_NAME(provider, domain, startver, endver, type, name)   provider##_##name##_##domain##_ver##startver##_##endver##_##type
 
#define ONNX_CPU_OPERATOR_VERSIONED_TYPED_KERNEL(name, startver, endver, type, builder,...)
 
#define ONNX_CPU_OPERATOR_VERSIONED_TYPED_ML_KERNEL(name, startver, endver, type, builder,...)
 
#define ONNX_CPU_OPERATOR_VERSIONED_TYPED_MS_KERNEL(name, startver, endver, type, builder,...)
 
#define ONNX_OPERATOR_VERSIONED_TYPED_KERNEL_EX(name, domain, startver, endver, type, provider, builder,...)
 
#define ONNX_OPERATOR_VERSIONED_TWO_TYPED_KERNEL_CLASS_NAME(provider, domain, startver, endver, type1, type2, name)   provider##_##name##_##domain##_ver##startver##_##endver##_##type1##_##type2
 
#define ONNX_OPERATOR_VERSIONED_TWO_TYPED_KERNEL_EX(name, domain, startver, endver, type1, type2,provider, builder,...)
 

Typedefs

using onnxruntime::KernelCreateFn = std::function< Status(FuncManager &func_mgr, const OpKernelInfo &info, std::unique_ptr< OpKernel > &out)>
 
using onnxruntime::KernelCreatePtrFn = std::add_pointer< Status(FuncManager &func_mgr, const OpKernelInfo &info, std::unique_ptr< OpKernel > &out)>::type
 
using onnxruntime::BuildKernelCreateInfoFn ) = KernelCreateInfo(*)(
 

Functions

std::unique_ptr< OpKernelInfo > onnxruntime::CopyOpKernelInfo (const OpKernelInfo &info)
 
template<typename T >
KernelCreateInfo onnxruntime::BuildKernelCreateInfo ()
 
template<typename T >
KernelCreateInfo onnxruntime::ml::BuildKernelCreateInfo ()
 
template<typename T >
KernelCreateInfo onnxruntime::contrib::BuildKernelCreateInfo ()
 
template<typename T >
KernelCreateInfo onnxruntime::contrib::cuda::BuildKernelCreateInfo ()
 
template<typename T >
KernelCreateInfo onnxruntime::contrib::js::BuildKernelCreateInfo ()
 
template<typename T >
KernelCreateInfo onnxruntime::contrib::rocm::BuildKernelCreateInfo ()
 
template<typename T >
KernelCreateInfo onnxruntime::contrib::snpe::BuildKernelCreateInfo ()
 
template<typename... Types>
std::vector< MLDataType > onnxruntime::BuildKernelDefConstraints ()
 
template<typename... Types>
std::vector< MLDataType > onnxruntime::BuildKernelDefSparseConstraints ()
 
template<typename L >
std::vector< MLDataType > onnxruntime::BuildKernelDefConstraintsFromTypeList ()
 
template<typename L >
std::vector< MLDataType > onnxruntime::BuildKernelDefSparseConstraintsFromTypeList ()
 

Macro Definition Documentation

#define ONNX_CPU_OPERATOR_KERNEL (   name,
  ver,
  builder,
  ... 
)    ONNX_OPERATOR_KERNEL_EX(name, kOnnxDomain, ver, kCpuExecutionProvider, builder, __VA_ARGS__)

Definition at line 212 of file op_kernel.h.

#define ONNX_CPU_OPERATOR_ML_KERNEL (   name,
  ver,
  builder,
  ... 
)    ONNX_OPERATOR_KERNEL_EX(name, kMLDomain, ver, kCpuExecutionProvider, builder, __VA_ARGS__)

Definition at line 215 of file op_kernel.h.

#define ONNX_CPU_OPERATOR_MS_KERNEL (   name,
  ver,
  builder,
  ... 
)    ONNX_OPERATOR_KERNEL_EX(name, kMSDomain, ver, kCpuExecutionProvider, builder, __VA_ARGS__)

Definition at line 218 of file op_kernel.h.

#define ONNX_CPU_OPERATOR_TYPED_KERNEL (   name,
  ver,
  type,
  builder,
  ... 
)    ONNX_OPERATOR_TYPED_KERNEL_EX(name, kOnnxDomain, ver, type, kCpuExecutionProvider, builder, __VA_ARGS__)

Definition at line 267 of file op_kernel.h.

#define ONNX_CPU_OPERATOR_TYPED_ML_KERNEL (   name,
  ver,
  type,
  builder,
  ... 
)    ONNX_OPERATOR_TYPED_KERNEL_EX(name, kMLDomain, ver, type, kCpuExecutionProvider, builder, __VA_ARGS__)

Definition at line 270 of file op_kernel.h.

#define ONNX_CPU_OPERATOR_TYPED_MS_KERNEL (   name,
  ver,
  type,
  builder,
  ... 
)    ONNX_OPERATOR_TYPED_KERNEL_EX(name, kMSDomain, ver, type, kCpuExecutionProvider, builder, __VA_ARGS__)

Definition at line 273 of file op_kernel.h.

#define ONNX_CPU_OPERATOR_VERSIONED_KERNEL (   name,
  startver,
  endver,
  builder,
  ... 
)    ONNX_OPERATOR_VERSIONED_KERNEL_EX(name, kOnnxDomain, startver, endver, kCpuExecutionProvider, builder, __VA_ARGS__)

Definition at line 244 of file op_kernel.h.

#define ONNX_CPU_OPERATOR_VERSIONED_ML_KERNEL (   name,
  startver,
  endver,
  builder,
  ... 
)    ONNX_OPERATOR_VERSIONED_KERNEL_EX(name, kMLDomain, startver, endver, kCpuExecutionProvider, builder, __VA_ARGS__)

Definition at line 247 of file op_kernel.h.

#define ONNX_CPU_OPERATOR_VERSIONED_TYPED_KERNEL (   name,
  startver,
  endver,
  type,
  builder,
  ... 
)
Value:
__VA_ARGS__)
#define ONNX_OPERATOR_VERSIONED_TYPED_KERNEL_EX(name, domain, startver, endver, type, provider, builder,...)
Definition: op_kernel.h:322
constexpr const char * kOnnxDomain
Definition: constants.h:14
GLuint const GLchar * name
Definition: glcorearb.h:786
constexpr const char * kCpuExecutionProvider
Definition: constants.h:32
type
Definition: core.h:1059

Definition at line 310 of file op_kernel.h.

#define ONNX_CPU_OPERATOR_VERSIONED_TYPED_ML_KERNEL (   name,
  startver,
  endver,
  type,
  builder,
  ... 
)
Value:
__VA_ARGS__)
#define ONNX_OPERATOR_VERSIONED_TYPED_KERNEL_EX(name, domain, startver, endver, type, provider, builder,...)
Definition: op_kernel.h:322
constexpr const char * kMLDomain
Definition: constants.h:17
GLuint const GLchar * name
Definition: glcorearb.h:786
constexpr const char * kCpuExecutionProvider
Definition: constants.h:32
type
Definition: core.h:1059

Definition at line 314 of file op_kernel.h.

#define ONNX_CPU_OPERATOR_VERSIONED_TYPED_MS_KERNEL (   name,
  startver,
  endver,
  type,
  builder,
  ... 
)
Value:
__VA_ARGS__)
#define ONNX_OPERATOR_VERSIONED_TYPED_KERNEL_EX(name, domain, startver, endver, type, provider, builder,...)
Definition: op_kernel.h:322
constexpr const char * kMSDomain
Definition: constants.h:18
GLuint const GLchar * name
Definition: glcorearb.h:786
constexpr const char * kCpuExecutionProvider
Definition: constants.h:32
type
Definition: core.h:1059

Definition at line 318 of file op_kernel.h.

#define ONNX_OPERATOR_KERNEL_CLASS_NAME (   provider,
  domain,
  ver,
  name 
)    provider##_##name##_##domain##_ver##ver

Definition at line 209 of file op_kernel.h.

#define ONNX_OPERATOR_KERNEL_EX (   name,
  domain,
  ver,
  provider,
  builder,
  ... 
)
Value:
class ONNX_OPERATOR_KERNEL_CLASS_NAME(provider, domain, ver, name); \
template <> \
KernelCreateInfo \
BuildKernelCreateInfo<ONNX_OPERATOR_KERNEL_CLASS_NAME(provider, domain, ver, name)>() { \
return KernelCreateInfo( \
builder.SetName(#name) \
.SetDomain(domain) \
.SinceVersion(ver) \
.Provider(provider) \
.Build(), \
static_cast<KernelCreatePtrFn>( \
[](FuncManager&, \
const OpKernelInfo& info, \
std::unique_ptr<OpKernel>& out) -> Status { \
out = std::make_unique<__VA_ARGS__>(info); \
return Status::OK(); \
})); \
}
GLuint const GLchar * name
Definition: glcorearb.h:786
#define ONNX_OPERATOR_KERNEL_CLASS_NAME(provider, domain, ver, name)
Definition: op_kernel.h:209
std::add_pointer< Status(FuncManager &func_mgr, const OpKernelInfo &info, std::unique_ptr< OpKernel > &out)>::type KernelCreatePtrFn
Definition: op_kernel.h:143

Definition at line 221 of file op_kernel.h.

#define ONNX_OPERATOR_TWO_TYPED_KERNEL_CLASS_NAME (   provider,
  domain,
  ver,
  type1,
  type2,
  name 
)    provider##_##name##_##domain##_ver##ver##_##type1##_##type2

Definition at line 290 of file op_kernel.h.

#define ONNX_OPERATOR_TWO_TYPED_KERNEL_EX (   name,
  domain,
  ver,
  type1,
  type2,
  provider,
  builder,
  ... 
)
Value:
class ONNX_OPERATOR_TWO_TYPED_KERNEL_CLASS_NAME(provider, domain, ver, type1, type2, name); \
template <> \
KernelCreateInfo \
BuildKernelCreateInfo<ONNX_OPERATOR_TWO_TYPED_KERNEL_CLASS_NAME(provider, domain, ver, type1, type2, name)>() { \
return KernelCreateInfo( \
builder.SetName(#name) \
.SetDomain(domain) \
.SinceVersion(ver) \
.Provider(provider) \
.Build(), \
static_cast<KernelCreatePtrFn>([](FuncManager&, const OpKernelInfo& info, std::unique_ptr<OpKernel>& out) -> Status { out = std::make_unique<__VA_ARGS__>(info); return Status::OK(); })); \
}
GLuint const GLchar * name
Definition: glcorearb.h:786
std::add_pointer< Status(FuncManager &func_mgr, const OpKernelInfo &info, std::unique_ptr< OpKernel > &out)>::type KernelCreatePtrFn
Definition: op_kernel.h:143
#define ONNX_OPERATOR_TWO_TYPED_KERNEL_CLASS_NAME(provider, domain, ver, type1, type2, name)
Definition: op_kernel.h:290

Definition at line 293 of file op_kernel.h.

#define ONNX_OPERATOR_TYPED_KERNEL_CLASS_NAME (   provider,
  domain,
  ver,
  type,
  name 
)    provider##_##name##_##domain##_ver##ver##_##type

Definition at line 264 of file op_kernel.h.

#define ONNX_OPERATOR_TYPED_KERNEL_EX (   name,
  domain,
  ver,
  type,
  provider,
  builder,
  ... 
)
Value:
class ONNX_OPERATOR_TYPED_KERNEL_CLASS_NAME(provider, domain, ver, type, name); \
template <> \
KernelCreateInfo \
BuildKernelCreateInfo<ONNX_OPERATOR_TYPED_KERNEL_CLASS_NAME(provider, domain, ver, type, name)>() { \
return KernelCreateInfo( \
builder.SetName(#name) \
.SetDomain(domain) \
.SinceVersion(ver) \
.Provider(provider) \
.Build(), \
static_cast<KernelCreatePtrFn>([](FuncManager&, const OpKernelInfo& info, std::unique_ptr<OpKernel>& out) -> Status { out = std::make_unique<__VA_ARGS__>(info); return Status::OK(); })); \
}
#define ONNX_OPERATOR_TYPED_KERNEL_CLASS_NAME(provider, domain, ver, type, name)
Definition: op_kernel.h:264
GLuint const GLchar * name
Definition: glcorearb.h:786
std::add_pointer< Status(FuncManager &func_mgr, const OpKernelInfo &info, std::unique_ptr< OpKernel > &out)>::type KernelCreatePtrFn
Definition: op_kernel.h:143
type
Definition: core.h:1059

Definition at line 276 of file op_kernel.h.

#define ONNX_OPERATOR_VERSIONED_KERNEL_CLASS_NAME (   provider,
  domain,
  startver,
  endver,
  name 
)    provider##_##name##_##domain##_ver##startver##_##endver

Definition at line 241 of file op_kernel.h.

#define ONNX_OPERATOR_VERSIONED_KERNEL_EX (   name,
  domain,
  startver,
  endver,
  provider,
  builder,
  ... 
)
Value:
class ONNX_OPERATOR_VERSIONED_KERNEL_CLASS_NAME(provider, domain, startver, endver, name); \
template <> \
KernelCreateInfo \
BuildKernelCreateInfo<ONNX_OPERATOR_VERSIONED_KERNEL_CLASS_NAME(provider, domain, startver, endver, name)>() { \
return KernelCreateInfo( \
builder.SetName(#name) \
.SetDomain(domain) \
.SinceVersion(startver, endver) \
.Provider(provider) \
.Build(), \
static_cast<KernelCreatePtrFn>([](FuncManager&, const OpKernelInfo& info, std::unique_ptr<OpKernel>& out) -> Status { out = std::make_unique<__VA_ARGS__>(info); return Status::OK(); })); \
}
GLuint const GLchar * name
Definition: glcorearb.h:786
#define ONNX_OPERATOR_VERSIONED_KERNEL_CLASS_NAME(provider, domain, startver, endver, name)
Definition: op_kernel.h:241
std::add_pointer< Status(FuncManager &func_mgr, const OpKernelInfo &info, std::unique_ptr< OpKernel > &out)>::type KernelCreatePtrFn
Definition: op_kernel.h:143

Definition at line 250 of file op_kernel.h.

#define ONNX_OPERATOR_VERSIONED_TWO_TYPED_KERNEL_CLASS_NAME (   provider,
  domain,
  startver,
  endver,
  type1,
  type2,
  name 
)    provider##_##name##_##domain##_ver##startver##_##endver##_##type1##_##type2

Definition at line 337 of file op_kernel.h.

#define ONNX_OPERATOR_VERSIONED_TWO_TYPED_KERNEL_EX (   name,
  domain,
  startver,
  endver,
  type1,
  type2,
  provider,
  builder,
  ... 
)
Value:
class ONNX_OPERATOR_VERSIONED_TWO_TYPED_KERNEL_CLASS_NAME(provider, domain, startver, endver, type1, type2, name); \
template <> \
type1, type2, name)>() { \
return KernelCreateInfo( \
builder.SetName(#name) \
.SetDomain(domain) \
.SinceVersion(startver, endver) \
.Provider(provider) \
.Build(), \
static_cast<KernelCreatePtrFn>([](FuncManager&, const OpKernelInfo& info, std::unique_ptr<OpKernel>& out) -> Status { out = std::make_unique<__VA_ARGS__>(info); return Status::OK(); })); \
}
KernelCreateInfo BuildKernelCreateInfo()
GLuint const GLchar * name
Definition: glcorearb.h:786
std::add_pointer< Status(FuncManager &func_mgr, const OpKernelInfo &info, std::unique_ptr< OpKernel > &out)>::type KernelCreatePtrFn
Definition: op_kernel.h:143
#define ONNX_OPERATOR_VERSIONED_TWO_TYPED_KERNEL_CLASS_NAME(provider, domain, startver, endver, type1, type2, name)
Definition: op_kernel.h:337

Definition at line 340 of file op_kernel.h.

#define ONNX_OPERATOR_VERSIONED_TYPED_KERNEL_CLASS_NAME (   provider,
  domain,
  startver,
  endver,
  type,
  name 
)    provider##_##name##_##domain##_ver##startver##_##endver##_##type

Definition at line 307 of file op_kernel.h.

#define ONNX_OPERATOR_VERSIONED_TYPED_KERNEL_EX (   name,
  domain,
  startver,
  endver,
  type,
  provider,
  builder,
  ... 
)
Value:
class ONNX_OPERATOR_VERSIONED_TYPED_KERNEL_CLASS_NAME(provider, domain, startver, endver, type, name); \
template <> \
type, name)>() { \
return KernelCreateInfo( \
builder.SetName(#name) \
.SetDomain(domain) \
.SinceVersion(startver, endver) \
.Provider(provider) \
.Build(), \
static_cast<KernelCreatePtrFn>([](FuncManager&, const OpKernelInfo& info, std::unique_ptr<OpKernel>& out) -> Status { out = std::make_unique<__VA_ARGS__>(info); return Status::OK(); })); \
}
#define ONNX_OPERATOR_VERSIONED_TYPED_KERNEL_CLASS_NAME(provider, domain, startver, endver, type, name)
Definition: op_kernel.h:307
KernelCreateInfo BuildKernelCreateInfo()
GLuint const GLchar * name
Definition: glcorearb.h:786
std::add_pointer< Status(FuncManager &func_mgr, const OpKernelInfo &info, std::unique_ptr< OpKernel > &out)>::type KernelCreatePtrFn
Definition: op_kernel.h:143
type
Definition: core.h:1059

Definition at line 322 of file op_kernel.h.