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

A Reducer class to reduce the structural equality result of two objects. More...

#include <structural_equal.h>

Inheritance diagram for tvm::SEqualReducer:
Collaboration diagram for tvm::SEqualReducer:

Classes

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

Public Member Functions

 SEqualReducer ()=default
 default constructor More...
 
 SEqualReducer (Handler *handler, bool map_free_vars)
 Constructor with a specific handler. More...
 
bool operator() (const ObjectRef &lhs, const ObjectRef &rhs) const
 Reduce condition to comparison of two objects. More...
 
bool DefEqual (const ObjectRef &lhs, const ObjectRef &rhs)
 Reduce condition to comparison of two definitions, where free vars can be mapped. More...
 
template<typename T >
bool operator() (const Array< T > &lhs, const Array< T > &rhs) const
 Reduce condition to comparison of two arrays. More...
 
bool FreeVarEqualImpl (const runtime::Object *lhs, const runtime::Object *rhs) const
 Implementation for equality rule of var type objects(e.g. TypeVar, tir::Var). More...
 
Handleroperator-> () const
 
- Public Member Functions inherited from tvm::BaseValueEqual
bool operator() (const double &lhs, const double &rhs) const
 
bool operator() (const int64_t &lhs, const int64_t &rhs) const
 
bool operator() (const uint64_t &lhs, const uint64_t &rhs) const
 
bool operator() (const int &lhs, const int &rhs) const
 
bool operator() (const bool &lhs, const bool &rhs) const
 
bool operator() (const std::string &lhs, const std::string &rhs) const
 
bool operator() (const DataType &lhs, const DataType &rhs) const
 
template<typename ENum , typename = typename std::enable_if<std::is_enum<ENum>::value>::type>
bool operator() (const ENum &lhs, const ENum &rhs) const
 

Detailed Description

A Reducer class to reduce the structural equality result of two objects.

The reducer will call the SEqualReduce function of each objects recursively. Importantly, the reducer may not directly use recursive calls to resolve the equality checking. Instead, it can store the necessary equality conditions and check later via an internally managed stack.

Constructor & Destructor Documentation

◆ SEqualReducer() [1/2]

tvm::SEqualReducer::SEqualReducer ( )
default

default constructor

◆ SEqualReducer() [2/2]

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

Constructor with a specific handler.

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

Member Function Documentation

◆ DefEqual()

bool tvm::SEqualReducer::DefEqual ( const ObjectRef lhs,
const ObjectRef rhs 
)
inline

Reduce condition to comparison of two definitions, where free vars can be mapped.

Call this function to compare definition points such as function params and var in a let-binding.

Parameters
lhsThe left operand.
rhsThe right operand.
Returns
the immediate check result.

◆ FreeVarEqualImpl()

bool tvm::SEqualReducer::FreeVarEqualImpl ( const runtime::Object lhs,
const runtime::Object rhs 
) const
inline

Implementation for equality rule of var type objects(e.g. TypeVar, tir::Var).

Parameters
lhsThe left operand.
rhsThe right operand.
Returns
the result.

◆ operator()() [1/2]

bool tvm::SEqualReducer::operator() ( const ObjectRef lhs,
const ObjectRef rhs 
) const
inline

Reduce condition to comparison of two objects.

Parameters
lhsThe left operand.
rhsThe right operand.
Returns
the immediate check result.

◆ operator()() [2/2]

template<typename T >
bool tvm::SEqualReducer::operator() ( const Array< T > &  lhs,
const Array< T > &  rhs 
) const
inline

Reduce condition to comparison of two arrays.

Parameters
lhsThe left operand.
rhsThe right operand.
Returns
the immediate check result.

◆ operator->()

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

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