Skip to content

Conversation

@tqchen
Copy link
Member

@tqchen tqchen commented Oct 14, 2018

  • Move type_annotation as a field of Var
    • Remove value_type in Let
    • Remove Param and use Var instead
  • Add/correct docstring of all python Expr class, make them self-contained.

The reasoning behind the change:

  • The current Param was a bit confusing and is only used in the place of the function parameter declaration. Folding the type annotation into Var allows removing one concept.
  • This will make the future graph style programming easier, which I will follow up with subsequent PR.

@tqchen
Copy link
Member Author

tqchen commented Oct 14, 2018

@MarisaKirisame @jroesch @slyubomirsky @joshpoll please review

@joshpoll
Copy link
Contributor

This actually makes a lot of sense and simplifies several things on the front end. 👍

@MarisaKirisame
Copy link
Contributor

I just did a skim, and LGTM.
Should we rename typeparam -> typevar then?

@tqchen
Copy link
Member Author

tqchen commented Oct 14, 2018

We can discuss typeparam vs typevar later with @jroesch

/*! \brief The tuple */
/*! \brief The tuple expression */
Expr tuple;
/*! \brief which value to get */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

capitalize

@property
def checked_type(self):
"""Get the checked type of relay.
"""Get the checked type of tvm.relay.
Copy link
Contributor

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." ?

class Constant(Expr):
"""A constant tensor in Relay, see tvm/relay/type.h for more details.
"""
"""A constant expression in Tvm.Relay.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"... in tvm.relay."


Parameters
----------
fields : list of tvm.relay.Expr.
Copy link
Contributor

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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"tvm.relay."

attrs: tvm.Attrs, optional
Attributes to the call, can be None

type_args: list of tvm.relay.Type
Copy link
Contributor

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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same edit as previous.

Parameters
----------
var: tvm.relay.Var
The local variable to be binded.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

binded -> bound

The local variable to be binded.

value: tvm.relay.Expr
The value to be binded.
Copy link
Contributor

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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Relay -> tvm.relay

@property
def checked_type(self):
"""Get the checked type of relay.
"""Get the checked type of tvm.relay.
Copy link
Contributor

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.
Copy link
Contributor

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) {
Copy link
Contributor

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?

Copy link
Member Author

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

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see.

@tqchen
Copy link
Member Author

tqchen commented Oct 14, 2018

@MarisaKirisame @joshpoll Thanks for the reviews, I have made changes according to your comments

@slyubomirsky
Copy link
Contributor

slyubomirsky commented Oct 15, 2018

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()
Copy link
Contributor

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.

Copy link
Member Author

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

@tqchen tqchen merged commit 0b4cc05 into apache:master Oct 15, 2018
@tqchen
Copy link
Member Author

tqchen commented Oct 15, 2018

Thanks @slyubomirsky @joshpoll @MarisaKirisame , this is merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants