LeshengJin commented on code in PR #16046:
URL: https://github.com/apache/tvm/pull/16046#discussion_r1380811920
##########
python/tvm/relax/frontend/nn/visitor.py:
##########
@@ -112,6 +113,14 @@ def visit(self, name: str, node: Any) -> Any:
ret_node: Any
The new node to replace current node.
"""
+
+ def _leaf_name(parent: str, child: str) -> str:
+ if parent == "":
+ # in the top level of the module
+ return child
+ else:
+ return f"{parent}.{child}"
+
if isinstance(node, nn.ModuleList):
for i in range(len(node)):
if isinstance(node[i], nn.ModuleList):
Review Comment:
It's a good question. I assume the top level is nn.Module, not
nn.ModuleList. Hence, when visiting nn.ModuleList, the name should not be left
as an empty string. @cyx-6 @junrushao
--
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]