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

This class wraps a raw pointer OrtKernelContext* that is being passed to the custom kernel Compute() method. Use it to safely access context attributes, input and output parameters with exception safety guarantees. See usage example in onnxruntime/test/testdata/custom_op_library/custom_op_library.cc More...

#include <onnxruntime_cxx_api.h>

Public Member Functions

 KernelContext (OrtKernelContext *context)
 
size_t GetInputCount () const
 
size_t GetOutputCount () const
 
ConstValue GetInput (size_t index) const
 
UnownedValue GetOutput (size_t index, const int64_t *dim_values, size_t dim_count) const
 
UnownedValue GetOutput (size_t index, const std::vector< int64_t > &dims) const
 
voidGetGPUComputeStream () const
 
Logger GetLogger () const
 
OrtAllocator * GetAllocator (const OrtMemoryInfo &memory_info) const
 
OrtKernelContext * GetOrtKernelContext () const
 
void ParallelFor (void(*fn)(void *, size_t), size_t total, size_t num_batch, void *usr_data) const
 

Detailed Description

This class wraps a raw pointer OrtKernelContext* that is being passed to the custom kernel Compute() method. Use it to safely access context attributes, input and output parameters with exception safety guarantees. See usage example in onnxruntime/test/testdata/custom_op_library/custom_op_library.cc

Definition at line 2051 of file onnxruntime_cxx_api.h.

Constructor & Destructor Documentation

Ort::KernelContext::KernelContext ( OrtKernelContext *  context)
inlineexplicit

Definition at line 1630 of file onnxruntime_cxx_inline.h.

Member Function Documentation

OrtAllocator * Ort::KernelContext::GetAllocator ( const OrtMemoryInfo memory_info) const
inline

Definition at line 1669 of file onnxruntime_cxx_inline.h.

void * Ort::KernelContext::GetGPUComputeStream ( ) const
inline

Definition at line 1663 of file onnxruntime_cxx_inline.h.

ConstValue Ort::KernelContext::GetInput ( size_t  index) const
inline

Definition at line 1645 of file onnxruntime_cxx_inline.h.

size_t Ort::KernelContext::GetInputCount ( ) const
inline

Definition at line 1633 of file onnxruntime_cxx_inline.h.

Logger Ort::KernelContext::GetLogger ( ) const
inline

Definition at line 1675 of file onnxruntime_cxx_inline.h.

OrtKernelContext* Ort::KernelContext::GetOrtKernelContext ( ) const
inline

Definition at line 2061 of file onnxruntime_cxx_api.h.

UnownedValue Ort::KernelContext::GetOutput ( size_t  index,
const int64_t *  dim_values,
size_t  dim_count 
) const
inline

Definition at line 1651 of file onnxruntime_cxx_inline.h.

UnownedValue Ort::KernelContext::GetOutput ( size_t  index,
const std::vector< int64_t > &  dims 
) const
inline

Definition at line 1657 of file onnxruntime_cxx_inline.h.

size_t Ort::KernelContext::GetOutputCount ( ) const
inline

Definition at line 1639 of file onnxruntime_cxx_inline.h.

void Ort::KernelContext::ParallelFor ( void(*)(void *, size_t)  fn,
size_t  total,
size_t  num_batch,
void usr_data 
) const
inline

Definition at line 1681 of file onnxruntime_cxx_inline.h.


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