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

Content-aware structural equality comparator for objects. More...

#include <structural_equal.h>

Inheritance diagram for tvm::StructuralEqual:
Collaboration diagram for tvm::StructuralEqual:

Public Member Functions

bool operator() (const ObjectRef &lhs, const ObjectRef &rhs, const bool map_free_params=false) const
 Compare objects via strutural equal. More...
 
- 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

Content-aware structural equality comparator for objects.

The structural equality is recursively defined in the DAG of IR nodes via SEqual. There are two kinds of nodes:

Vars(tir::Var, TypeVar) and non-constant relay expression nodes are graph nodes. For example, it means that %1 = x + y; %1 + %1 is not structurally equal to %1 = x + y; %2 = x + y; %1 + %2 in relay.

A var-type node(e.g. tir::Var, TypeVar) can be mapped as equal to another var with the same type if one of the following condition holds:

Member Function Documentation

◆ operator()()

bool tvm::StructuralEqual::operator() ( const ObjectRef lhs,
const ObjectRef rhs,
const bool  map_free_params = false 
) const

Compare objects via strutural equal.

Parameters
lhsThe left operand.
rhsThe right operand.
map_free_paramsWhether or not to map free variables.
Returns
The comparison result.

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