HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
onnxruntime::utils::MLTypeCallDispatcher< Types > Class Template Reference

#include <data_types_internal.h>

Public Member Functions

 MLTypeCallDispatcher (int32_t dt_type) noexcept
 
template<template< typename...> class Fn, typename... Args>
void Invoke (Args &&...args) const
 
template<template< typename...> class Fn, typename LeadingTemplateArgTypeList , typename... Args>
void InvokeWithLeadingTemplateArgs (Args &&...args) const
 
template<class Ret , template< typename...> class Fn, typename... Args>
Ret InvokeRet (Args &&...args) const
 
template<class Ret , template< typename...> class Fn, class UnsupportedPolicy , typename... Args>
Ret InvokeRetWithUnsupportedPolicy (Args &&...args) const
 
template<class Ret , template< typename...> class Fn, typename LeadingTemplateArgTypeList , typename... Args>
Ret InvokeRetWithLeadingTemplateArgs (Args &&...args) const
 
template<class Ret , template< typename...> class Fn, class UnsupportedPolicy , typename LeadingTemplateArgTypeList , typename... Args>
Ret InvokeRetWithUnsupportedPolicyAndLeadingTemplateArgs (Args &&...args) const
 

Detailed Description

template<typename... Types>
class onnxruntime::utils::MLTypeCallDispatcher< Types >

This class helps to efficiently dispatch calls to implementation function objects with a tensor element type template argument.

The constructor accepts a value corresponding to a tensor element type. For example, it can be obtained from: input_tensor->GetElementType()

The Invoke member functions will instantiate and invoke the provided function object template, Fn. Fn must be default constructible. Fn must also have a tensor element type template argument. This type template argument will be the type that corresponds to the value given in the constructor. These functions accept and forward arbitrary function arguments. They ensure that Fn is called once with the type specified in the constructor.

Template Parameters
TypesThe types supported by the implementation. This should be a set of ONNX tensor element types that are supported by ORT.

Definition at line 259 of file data_types_internal.h.

Constructor & Destructor Documentation

template<typename... Types>
onnxruntime::utils::MLTypeCallDispatcher< Types >::MLTypeCallDispatcher ( int32_t  dt_type)
inlineexplicitnoexcept

Constructor.

Parameters
dt_typeThe value corresponding to the tensor element type to be dispatched to. This can be obtained from input_tensor->GetElementType() or utils::ToTensorProtoElementType<T>().

Definition at line 284 of file data_types_internal.h.

Member Function Documentation

template<typename... Types>
template<template< typename...> class Fn, typename... Args>
void onnxruntime::utils::MLTypeCallDispatcher< Types >::Invoke ( Args &&...  args) const
inline

Invokes Fn<T> with the specified arguments.

Template Parameters
FnThe function object template.
ArgsThe argument types.

Definition at line 293 of file data_types_internal.h.

template<typename... Types>
template<class Ret , template< typename...> class Fn, typename... Args>
Ret onnxruntime::utils::MLTypeCallDispatcher< Types >::InvokeRet ( Args &&...  args) const
inline

Invokes Fn<T> with the specified arguments and returns the result.

Template Parameters
RetThe return type. Fn should return a type convertible to Ret.
FnThe function object template.
ArgsThe argument types.

Definition at line 335 of file data_types_internal.h.

template<typename... Types>
template<class Ret , template< typename...> class Fn, typename LeadingTemplateArgTypeList , typename... Args>
Ret onnxruntime::utils::MLTypeCallDispatcher< Types >::InvokeRetWithLeadingTemplateArgs ( Args &&...  args) const
inline

Invokes Fn<..., T> with leading template arguments and the specified arguments and returns the result.

Template Parameters
RetThe return type. Fn should return a type convertible to Ret.
FnThe function object template.
LeadingTemplateArgTypeListA type list of the leading template arguments.
ArgsThe argument types.

Definition at line 369 of file data_types_internal.h.

template<typename... Types>
template<class Ret , template< typename...> class Fn, class UnsupportedPolicy , typename... Args>
Ret onnxruntime::utils::MLTypeCallDispatcher< Types >::InvokeRetWithUnsupportedPolicy ( Args &&...  args) const
inline

Invokes Fn<T> with the specified arguments and returns the result.

Template Parameters
RetThe return type. Fn should return a type convertible to Ret.
FnThe function object template.
UnsupportedPolicyThe policy used to handle unsupported types. See mltype_dispatcher_internal::UnsupportedTypeDefaultPolicy for an example.
ArgsThe argument types.

Definition at line 352 of file data_types_internal.h.

template<typename... Types>
template<class Ret , template< typename...> class Fn, class UnsupportedPolicy , typename LeadingTemplateArgTypeList , typename... Args>
Ret onnxruntime::utils::MLTypeCallDispatcher< Types >::InvokeRetWithUnsupportedPolicyAndLeadingTemplateArgs ( Args &&...  args) const
inline

Invokes Fn<..., T> with leading template arguments and the specified arguments and returns the result.

Template Parameters
RetThe return type. Fn should return a type convertible to Ret.
FnThe function object template.
UnsupportedPolicyThe policy used to handle unsupported types. See mltype_dispatcher_internal::UnsupportedTypeDefaultPolicy for an example.
LeadingTemplateArgTypeListA type list of the leading template arguments.
ArgsThe argument types.

Definition at line 393 of file data_types_internal.h.

template<typename... Types>
template<template< typename...> class Fn, typename LeadingTemplateArgTypeList , typename... Args>
void onnxruntime::utils::MLTypeCallDispatcher< Types >::InvokeWithLeadingTemplateArgs ( Args &&...  args) const
inline

Invokes Fn<..., T> with leading template arguments and the specified arguments.

Template Parameters
FnThe function object template.
LeadingTemplateArgTypeListA type list of the leading template arguments.
ArgsThe argument types.

Definition at line 307 of file data_types_internal.h.


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