tvm
|
A Reducer class to reduce the structural hash value. More...
#include <structural_hash.h>
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... | |
Handler * | operator-> () const |
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.
|
default |
default constructor
|
inlineexplicit |
Constructor with a specific handler.
handler | The equal handler for objects. |
map_free_vars | Whether to map free variables. |
|
inline |
Push hash of key to the current sequence of hash values.
key | The key to be hashed. |
|
inline |
Implementation for hash for a free var.
var | The variable. |
|
inline |
Push hash of key to the current sequence of hash values.
key | The key to be hashed. |
|
inline |
Push hash of key to the current sequence of hash values.
key | The key to be hashed. |
|
inline |