junrushao1994 commented on code in PR #12101:
URL: https://github.com/apache/tvm/pull/12101#discussion_r931672392


##########
python/tvm/runtime/object_path.py:
##########
@@ -122,3 +123,14 @@ class MapValuePath(ObjectPath):
 @tvm._ffi.register_object("MissingMapEntryPath")
 class MissingMapEntryPath(ObjectPath):
     pass
+
+
+@tvm._ffi.register_object("ObjectPathPair")
+class ObjectPathPair(Object):
+    @property
+    def lhs_path(self) -> ObjectPath:
+        return _ffi_node_api.ObjectPathPairLhsPath(self)
+
+    @property
+    def rhs_path(self) -> ObjectPath:
+        return _ffi_node_api.ObjectPathPairRhsPath(self)

Review Comment:
   If you reflection is defined inside `ObjectPathPair`, then we don't need any 
boilerplate code for attribute access, e.g.
   
   ```C++
   // inside `ObjectPathPairNode`
   void VisitAttrs(tvm::AttrVisitor* v) {
     v->Visit("lhs_path", &lhs_path);
     v->Visit("rhs_path", &rhs_path);
   }
   // in a cc file
   
   - TVM_REGISTER_OBJECT_TYPE(ObjectPathPairNode);
   + TVM_REGISTER_NODE_TYPE(ObjectPathPairNode);
   ```
   
   



-- 
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: commits-unsubscr...@tvm.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to