Skip to content
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

[Relay] Unifier hotfix #2437

Merged
merged 55 commits into from
Jan 16, 2019
Merged

[Relay] Unifier hotfix #2437

merged 55 commits into from
Jan 16, 2019

Conversation

slyubomirsky
Copy link
Contributor

This restores the changes originally in #2189, which led to an error when merged because of automatic differentiation. It turned out there was an error in the gradient code that was propagating null type annotations.

… is added, not during unification. Resolve before running a relation
* If the annotation is defined, return it.
* Otherwise, return a type hole.
*/
Type FromAnnotation(const Type& annotation) {
Copy link
Contributor Author

@slyubomirsky slyubomirsky Jan 15, 2019

Choose a reason for hiding this comment

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

I am not sure this is the best way to handle this issue, since it is essentially duplicating what type inference does. Having undefined types inside other types is rather disconcerting to me and I think we shouldn't have them, but I am not sure how to dispel them in general. Could we make it so that a non-annotated type is made an incomplete type from the start? Would be curious as to your thoughts, @jroesch

Copy link
Member

Choose a reason for hiding this comment

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

I think this is bug in Marisa's code, if he wants the system to do type inference for him it needs to insert incomplete types. If he wants the code to be polymorphic he needs to use polymorphism. It is invalid to have variables with p->type_annotation to null afaik.

Copy link
Member

Choose a reason for hiding this comment

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

I think the issue is he is calling Push everywhere without providing a type, and expecting type inference, for example see line 134:

ll->Push(Add(args[i]->get<ADTensor>().reverse, rev[i]));

The push method will create a new variable with a null type annotation. I think if you change the call sites to provide an incomplete type

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will investigate let lists, but I think the nulls are coming from function nodes and var nodes directly: A function node whose return type annotation is omitted has a null type for the ret_type field by default and a var node whose type annotation is omitted has a null type for the annotation field by default (I believe).

@tqchen
Copy link
Member

tqchen commented Jan 16, 2019

@jroesch please take another look and approve again

@slyubomirsky
Copy link
Contributor Author

To avoid the weird issue (I discussed offline with @jroesch) of introducing incomplete types other than in type inference, I've rewritten it so the type annotation is omitted altogether if the annotations are omitted. This should be reasonable unless it turns out there is not enough information later.

@jroesch
Copy link
Member

jroesch commented Jan 16, 2019

Great that looks good to me.

@tqchen tqchen merged commit 6783d37 into apache:master Jan 16, 2019
@tqchen
Copy link
Member

tqchen commented Jan 16, 2019

Thanks, to @jroesch @slyubomirsky , this is now merged

Anthony-Mai pushed a commit to Anthony-Mai/tvm that referenced this pull request Jan 20, 2019
Anthony-Mai pushed a commit to Anthony-Mai/tvm that referenced this pull request Jan 20, 2019
Anthony-Mai pushed a commit to Anthony-Mai/tvm that referenced this pull request Jan 25, 2019
Anthony-Mai pushed a commit to Anthony-Mai/tvm that referenced this pull request Jan 28, 2019
Anthony-Mai pushed a commit to Anthony-Mai/tvm that referenced this pull request Jan 28, 2019
wweic pushed a commit to neo-ai/tvm that referenced this pull request Feb 20, 2019
wweic pushed a commit to neo-ai/tvm that referenced this pull request Feb 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants