[RELAY][IR] Move type_annotation to Var, remove Param#1900
[RELAY][IR] Move type_annotation to Var, remove Param#1900tqchen merged 2 commits intoapache:masterfrom
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 */ |
| @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.
Should this be "...of a tvm.relay type." ?
| class Constant(Expr): | ||
| """A constant tensor in Relay, see tvm/relay/type.h for more details. | ||
| """ | ||
| """A constant expression in Tvm.Relay. |
|
|
||
| Parameters | ||
| ---------- | ||
| fields : list of tvm.relay.Expr. |
There was a problem hiding this comment.
"fields: List[tvm.relay.Expr]"
| @register_relay_node | ||
| class Var(Expr): | ||
| """A local variable in Relay.""" | ||
| """A local variable in Tvm.Relay. |
| 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.
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. |
| Parameters | ||
| ---------- | ||
| var: tvm.relay.Var | ||
| The local variable to be binded. |
| The local variable to be binded. | ||
|
|
||
| value: tvm.relay.Expr | ||
| The value to be binded. |
| @register_relay_node | ||
| class If(Expr): | ||
| """A conditional expression in Relay, see tvm/relay/expr.h for more details.""" | ||
| """A conditional expression in Relay. |
| @property | ||
| def checked_type(self): | ||
| """Get the checked type of relay. | ||
| """Get the checked type of tvm.relay. |
| @register_relay_node | ||
| class Call(Expr): | ||
| """A function call in Relay, see tvm/relay/expr.h for more details.""" | ||
| """Function call node in 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.
can you call docify directly?
There was a problem hiding this comment.
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
|
@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.
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.
was removed because TypeParam nolonger exists
|
Thanks @slyubomirsky @joshpoll @MarisaKirisame , this is merged |
The reasoning behind the change: