tqchen commented on a change in pull request #5687:
URL: https://github.com/apache/incubator-tvm/pull/5687#discussion_r434089882



##########
File path: include/tvm/runtime/container.h
##########
@@ -1151,6 +1151,42 @@ class String : public ObjectRef {
    */
   inline String operator=(std::string other);
 
+  /*!
+   * \brief Compare is less than other std::string
+   *
+   * \param other The other string
+   *
+   * \return the comparison result
+   */
+  bool operator<(const std::string& other) const { return this->compare(other) 
< 0; }
+
+  /*!
+   * \brief Compare is greater than other std::string
+   *
+   * \param other The other string
+   *
+   * \return the comparison result
+   */
+  bool operator>(const std::string& other) const { return this->compare(other) 
> 0; }

Review comment:
       let us add regression testcases!

##########
File path: include/tvm/node/container.h
##########
@@ -49,11 +50,24 @@ using runtime::ObjectRef;
 using runtime::String;
 using runtime::StringObj;
 
+struct MapObjectHash {
+  size_t operator()(const ObjectRef& a) const {
+    return a->IsInstance<StringObj>() ? 
std::hash<String>()(Downcast<String>(a)) : ObjectHash()(a);
+  }
+};
+
+struct MapObjectEqual {
+  bool operator()(const ObjectRef& a, const ObjectRef& b) const {
+    return a.same_as(b) || (a->IsInstance<StringObj>() && 
b->IsInstance<StringObj>() &&

Review comment:
       we might want to optimize the case a bit for string, because downcast 
and IsInstance are duplicated.

##########
File path: include/tvm/node/container.h
##########
@@ -49,11 +50,24 @@ using runtime::ObjectRef;
 using runtime::String;
 using runtime::StringObj;
 
+struct MapObjectHash {

Review comment:
       can we simply change ObjectHash to this impl?




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to