diff --git a/include/tvm/node/structural_equal.h b/include/tvm/node/structural_equal.h index 372cbc52bcc8..46087f0bda40 100644 --- a/include/tvm/node/structural_equal.h +++ b/include/tvm/node/structural_equal.h @@ -357,7 +357,11 @@ class SEqualReducer { // depth as array comparison is pretty common. if (lhs.size() != rhs.size()) return false; for (size_t i = 0; i < lhs.size(); ++i) { - if (!(operator()(lhs[i], rhs[i]))) return false; + if constexpr (std::is_same_v) { + if (!(AnyEqual(lhs[i], rhs[i]))) return false; + } else { + if (!(operator()(lhs[i], rhs[i]))) return false; + } } return true; }