LeiWang1999 commented on PR #18096:
URL: https://github.com/apache/tvm/pull/18096#issuecomment-3079719841

   Curious to learn why we need to refactor this part, and how we can reuse 
part of the parent class's reflect methods.
   
   ```python
   class SwizzledLayoutNode: LayoutNode {
   ...
   }
   
   
   # old code with AttrVisitor 
   void LayoutNode::VisitAttrs(AttrVisitor *v) {
     v->Visit("input_size", &input_size_);
     v->Visit("forward_index", &forward_index_);
   }
   
   void SwizzledLayoutNode::VisitAttrs(tvm::AttrVisitor *v) {
     LayoutNode::VisitAttrs(v);
   }
   
   # new code
   void LayoutNode::RegisterReflection() {
     namespace refl = tvm::ffi::reflection;
     refl::ObjectDef<LayoutNode>()
         .def_ro("input_size", &LayoutNode::input_size)
         .def_ro("forward_index", &LayoutNode::forward_index);
   }
   
   void SwizzledLayoutNode::RegisterReflection() {
     namespace refl = tvm::ffi::reflection;
      ?
   }
   ```


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