tvm
Classes | Public Member Functions | List of all members
tvm::SHashReducer Class Reference

A Reducer class to reduce the structural hash value. More...

#include <structural_hash.h>

Collaboration diagram for tvm::SHashReducer:

Classes

class  Handler
 Internal handler that defines custom behaviors. More...
 

Public Member Functions

 SHashReducer ()=default
 default constructor More...
 
 SHashReducer (Handler *handler, bool map_free_vars)
 Constructor with a specific handler. More...
 
template<typename T , typename = typename std::enable_if<!std::is_base_of<ObjectRef, T>::value>::type>
void operator() (const T &key) const
 Push hash of key to the current sequence of hash values. More...
 
void operator() (const ObjectRef &key) const
 Push hash of key to the current sequence of hash values. More...
 
void DefHash (const ObjectRef &key) const
 Push hash of key to the current sequence of hash values. More...
 
void FreeVarHashImpl (const runtime::Object *var) const
 Implementation for hash for a free var. More...
 
Handleroperator-> () const
 

Detailed Description

A Reducer class to reduce the structural hash value.

The reducer will call the SEqualHash function of each objects recursively.

A SEqualHash function will make a sequence of calls to the reducer to indicate a sequence of child hash values that the reducer need to combine inorder to obtain the hash value of the hash value of the parent object.

Importantly, the reducer may not directly use recursive calls to compute the hash values of child objects directly.

Instead, it can store the necessary hash computing task into a stack and reduce the result later.

Constructor & Destructor Documentation

◆ SHashReducer() [1/2]

tvm::SHashReducer::SHashReducer ( )
default

default constructor

◆ SHashReducer() [2/2]

tvm::SHashReducer::SHashReducer ( Handler handler,
bool  map_free_vars 
)
inlineexplicit

Constructor with a specific handler.

Parameters
handlerThe equal handler for objects.
map_free_varsWhether to map free variables.

Member Function Documentation

◆ DefHash()

void tvm::SHashReducer::DefHash ( const ObjectRef key) const
inline

Push hash of key to the current sequence of hash values.

Parameters
keyThe key to be hashed.
Note
This function indicate key could contain var defintions.

◆ FreeVarHashImpl()

void tvm::SHashReducer::FreeVarHashImpl ( const runtime::Object var) const
inline

Implementation for hash for a free var.

Parameters
varThe variable.

◆ operator()() [1/2]

void tvm::SHashReducer::operator() ( const ObjectRef key) const
inline

Push hash of key to the current sequence of hash values.

Parameters
keyThe key to be hashed.

◆ operator()() [2/2]

template<typename T , typename = typename std::enable_if<!std::is_base_of<ObjectRef, T>::value>::type>
void tvm::SHashReducer::operator() ( const T &  key) const
inline

Push hash of key to the current sequence of hash values.

Parameters
keyThe key to be hashed.

◆ operator->()

Handler* tvm::SHashReducer::operator-> ( ) const
inline
Returns
Get the internal handler.

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