junrushao1994 commented on code in PR #12101:
URL: https://github.com/apache/tvm/pull/12101#discussion_r931430515
##########
include/tvm/node/structural_equal.h:
##########
@@ -56,6 +57,31 @@ class BaseValueEqual {
}
};
+/*!
+ * \brief Pair of `ObjectPath`s, one for each object being tested for
structural equality.
+ */
+struct ObjectPathPair {
+ ObjectPath lhs_path;
+ ObjectPath rhs_path;
+};
+
+// Could be replaced with std::optional<ObjectPathPair>
+class OptionalObjectPathPair {
+ public:
+ OptionalObjectPathPair() = default;
+
+ OptionalObjectPathPair(const ObjectPathPair& p) // NOLINT(runtime/explicit)
+ : lhs_path(p.lhs_path), rhs_path(p.rhs_path) {}
+
+ bool defined() const { return lhs_path.defined(); }
+
+ ObjectPathPair value() const { return {lhs_path.value(), rhs_path.value()}; }
+
+ private:
+ Optional<ObjectPath> lhs_path;
+ Optional<ObjectPath> rhs_path;
+};
+
Review Comment:
Quick question: if `ObjectPathPair` is a TVM object, then we don't need to
define another class as the optional wrapper - is my understanding correct?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]