You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2022/07/19 04:49:36 UTC
[GitHub] [tvm] yelite commented on a diff in pull request #12048: [TVMScript] ExprDoc
yelite commented on code in PR #12048:
URL: https://github.com/apache/tvm/pull/12048#discussion_r924055842
##########
python/tvm/script/printer/doc.py:
##########
@@ -29,12 +34,63 @@ class Doc(Object):
class ExprDoc(Object):
"""Base class of all expression Docs"""
+ def attr_access(self, attr: str) -> "AttrAccessDoc":
Review Comment:
This is a tricky one. If strictly following C++ APIs and Python name convention, we will have
```python
doc.attr # helper method to create AttrAccessDoc
doc.attr # AttrAccessDoc's `attr` attribute, that's a name conflict
doc.index # helper method to create IndexDoc
doc.indices # attribute of IndexDoc, looks similar to the method above
```
An option is to update the C++ API to `AttrAccess` and `IndexAccess`, which makes the code slightly more verbose
```cpp
TIR(p)->Attr("cast")
// becomes
TIR(p)->AttrAccess("cast")
```
What do you think?
--
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-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org