tvm
Public Member Functions | List of all members
tvm::With< ContextType > Class Template Reference

RAII wrapper function to enter and exit a context object similar to python's with syntax. More...

#include <with.h>

Collaboration diagram for tvm::With< ContextType >:

Public Member Functions

template<typename... Args>
 With (Args &&... args)
 constructor. Enter the scope of the context. More...
 
 ~With () DMLC_THROW_EXCEPTION
 destructor, leaves the scope of the context. More...
 

Detailed Description

template<typename ContextType>
class tvm::With< ContextType >

RAII wrapper function to enter and exit a context object similar to python's with syntax.

// context class
class MyContext {
private:
friend class With<MyContext>;
MyContext(arguments);
void EnterWithScope();
void ExitWithScope();
};
{
With<MyContext> scope(arguments);
// effect take place.
}
Template Parameters
ContextTypeType of the context object.

Constructor & Destructor Documentation

◆ With()

template<typename ContextType >
template<typename... Args>
tvm::With< ContextType >::With ( Args &&...  args)
inlineexplicit

constructor. Enter the scope of the context.

◆ ~With()

template<typename ContextType >
tvm::With< ContextType >::~With ( )
inline

destructor, leaves the scope of the context.


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