-
Notifications
You must be signed in to change notification settings - Fork 3.8k
[RELAY][IR] Move type_annotation to Var, remove Param #1900
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@MarisaKirisame @jroesch @slyubomirsky @joshpoll please review |
|
This actually makes a lot of sense and simplifies several things on the front end. 👍 |
|
I just did a skim, and LGTM. |
|
We can discuss typeparam vs typevar later with @jroesch |
| /*! \brief The tuple */ | ||
| /*! \brief The tuple expression */ | ||
| Expr tuple; | ||
| /*! \brief which value to get */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
capitalize
python/tvm/relay/expr.py
Outdated
| @property | ||
| def checked_type(self): | ||
| """Get the checked type of relay. | ||
| """Get the checked type of tvm.relay. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be "...of a tvm.relay type." ?
python/tvm/relay/expr.py
Outdated
| class Constant(Expr): | ||
| """A constant tensor in Relay, see tvm/relay/type.h for more details. | ||
| """ | ||
| """A constant expression in Tvm.Relay. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"... in tvm.relay."
python/tvm/relay/expr.py
Outdated
|
|
||
| Parameters | ||
| ---------- | ||
| fields : list of tvm.relay.Expr. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"fields: List[tvm.relay.Expr]"
| @register_relay_node | ||
| class Var(Expr): | ||
| """A local variable in Relay.""" | ||
| """A local variable in Tvm.Relay. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"tvm.relay."
python/tvm/relay/expr.py
Outdated
| attrs: tvm.Attrs, optional | ||
| Attributes to the call, can be None | ||
|
|
||
| type_args: list of tvm.relay.Type |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
type_args: List[tvm.relay.Type]
|
|
||
| type_args: list of tvm.relay.Type | ||
| The additional type arguments, this is only | ||
| used in advanced usecase of template functions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same edit as previous.
python/tvm/relay/expr.py
Outdated
| Parameters | ||
| ---------- | ||
| var: tvm.relay.Var | ||
| The local variable to be binded. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
binded -> bound
python/tvm/relay/expr.py
Outdated
| The local variable to be binded. | ||
|
|
||
| value: tvm.relay.Expr | ||
| The value to be binded. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
binded -> bound
| @register_relay_node | ||
| class If(Expr): | ||
| """A conditional expression in Relay, see tvm/relay/expr.h for more details.""" | ||
| """A conditional expression in Relay. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Relay -> tvm.relay
python/tvm/relay/expr.py
Outdated
| @property | ||
| def checked_type(self): | ||
| """Get the checked type of relay. | ||
| """Get the checked type of tvm.relay. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
of relay expr?
| @register_relay_node | ||
| class Call(Expr): | ||
| """A function call in Relay, see tvm/relay/expr.h for more details.""" | ||
| """Function call node in Relay. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tvm.Relay
| std::vector<Doc> vec; | ||
| for (size_t i = 0; i < arr.size(); ++i) { | ||
| vec.push_back(Docify(arr[i])); | ||
| for (Var param : arr) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you call docify directly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My understanding is that we cannot directly docify because there are two behaviors(at the declaration point where the type annotation need to be printed), at the usage point where we don't want to print type annotations
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see.
|
@MarisaKirisame @joshpoll Thanks for the reviews, I have made changes according to your comments |
|
Agreed with previous comments, this is certainly a good simplification to make. LGTM, for the most part. |
| test_tensor_type_alpha_equal() | ||
| test_incomplete_type_alpha_equal() | ||
| test_constant_alpha_equal() | ||
| test_type_param_alpha_equal() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why have test_type_param_alpha_equal() and test_var_alpha_equal() been eliminated from the main method? Those test cases don't appear to have been eliminated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
was removed because TypeParam nolonger exists
|
Thanks @slyubomirsky @joshpoll @MarisaKirisame , this is merged |
The reasoning behind the change: