tvm
Public Member Functions | List of all members
tvm::runtime::TVMPODValue_CRTP_< Derived > Class Template Reference

A utility class that adds methods useful for each POD type. More...

#include <packed_func.h>

Inheritance diagram for tvm::runtime::TVMPODValue_CRTP_< Derived >:
Collaboration diagram for tvm::runtime::TVMPODValue_CRTP_< Derived >:

Public Member Functions

template<typename TObjectRef , typename = typename std::enable_if<std::is_base_of<ObjectRef, TObjectRef>::value>::type>
bool IsObjectRef () const
 
template<typename TObjectRef >
TObjectRef AsObjectRef () const
 
 operator double () const
 
 operator int64_t () const
 
 operator uint64_t () const
 
 operator int () const
 
 operator bool () const
 
 TVMPODValue_ ()
 
 TVMPODValue_ (TVMValue value, int type_code)
 
- Public Member Functions inherited from tvm::runtime::TVMPODValue_
 operator void * () const
 
 operator DLTensor * () const
 
 operator NDArray () const
 
 operator Module () const
 
 operator PackedFunc () const
 
 operator Device () const
 
int type_code () const
 
template<typename T >
T * ptr () const
 return handle as specific pointer type. More...
 
std::optional< bool > TryAsBool () const
 
std::optional< int64_t > TryAsInt () const
 
std::optional< double > TryAsFloat () const
 

Additional Inherited Members

- Protected Member Functions inherited from tvm::runtime::TVMPODValue_
 TVMPODValue_ ()
 
 TVMPODValue_ (TVMValue value, int type_code)
 
- Protected Attributes inherited from tvm::runtime::TVMPODValue_
TVMValue value_
 The value. More...
 
int type_code_
 the type code More...
 

Detailed Description

template<typename Derived>
class tvm::runtime::TVMPODValue_CRTP_< Derived >

A utility class that adds methods useful for each POD type.

These cannot be provided in the base PODValue_ class, because TVMArgValue and TVMRetValue have different semantics for kTVMStr and kTVMBytes.

kTVMStr:

For `TVMArgValue`, the active variant is `v_str`, a `const
char*`.  For `TVMRetValue`, the active variant is `v_handle`,
and should be cast from `void*` to `std::string*`.

kTVMBytes:

The active variant is `v_handle`, a `void*`.  For
`TVMArgValue`, should be cast to `TVMByteArray*`.  For
`TVMRetValue`, should be cast to `std::string*`.

When converting into an ObjectRef, a string may be used to build a tvm::runtime::String. Because TVMArgValue and TVMRetValue use different representations for strings, any utility funciton which might attempt a conversion to an ObjectRef must be performed within a context that is aware of the derived class.

Member Function Documentation

◆ AsObjectRef()

template<typename Derived >
template<typename TObjectRef >
TObjectRef tvm::runtime::TVMPODValue_CRTP_< Derived >::AsObjectRef
inline

◆ IsObjectRef()

template<typename Derived >
template<typename TObjectRef , typename >
bool tvm::runtime::TVMPODValue_CRTP_< Derived >::IsObjectRef
inline

◆ operator bool()

template<typename Derived >
tvm::runtime::TVMPODValue_CRTP_< Derived >::operator bool ( ) const
inline

◆ operator double()

template<typename Derived >
tvm::runtime::TVMPODValue_CRTP_< Derived >::operator double ( ) const
inline

◆ operator int()

template<typename Derived >
tvm::runtime::TVMPODValue_CRTP_< Derived >::operator int ( ) const
inline

◆ operator int64_t()

template<typename Derived >
tvm::runtime::TVMPODValue_CRTP_< Derived >::operator int64_t ( ) const
inline

◆ operator uint64_t()

template<typename Derived >
tvm::runtime::TVMPODValue_CRTP_< Derived >::operator uint64_t ( ) const
inline

◆ TVMPODValue_() [1/2]

template<typename Derived >
tvm::runtime::TVMPODValue_::TVMPODValue_
inline

◆ TVMPODValue_() [2/2]

template<typename Derived >
tvm::runtime::TVMPODValue_::TVMPODValue_
inline

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