-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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] Remove Free Variables/Free Type Variables in Module #3476
Conversation
Functions in a module must be closed in both expression and type scope. |
@eqy I change the output of some test in autotvm. Can you look and make sure it is ok? |
@MarisaKirisame This change sounds good to me. I took a look into the error. It seems that there is some thing wrong with binding. |
@MarisaKirisame thanks, I see you are correcting it. Otherwise, creating a new Function in |
@zhiics I did both. |
I think the newly added warning in the module should be an error, but there is too much instance and I need this fix to fix PE, so I think we can do it in another PR. |
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.
LGTM. Please fix the conflict.
49089cf
to
2cb1e11
Compare
src/relay/ir/module.cc
Outdated
auto fv = FreeVars(func); | ||
auto ftv = FreeTypeVars(func, mod); | ||
if (fv.size() != 0) { | ||
std::cout |
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.
use LOG(WARNING)
src/relay/ir/module.cc
Outdated
<< "warning: there are free variables: " | ||
<< fv | ||
<< " in function: " | ||
<< AsText(func) |
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.
AsText(func, false)
to omit meta data
74dab7a
to
761b764
Compare
@MarisaKirisame How about making it a pass so pass can depend on it if needed? Would it fix the partial type inference failure? |
@wweic reexposing the function -> function pass will also work. |
@MarisaKirisame @wweic It think making it into a pass probably will not solve the problem. It looks to me that partial TI is not really quite needed if very thing is baked into a module. How do you guys think? @jroesch |
I think we should have a special API for partial type inference, so people know when they are opting in. We just make all the free vars dummy parameters, run inference then remove them. |
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.
@MarisaKirisame @kevinthesun added the graph tuner tests I believe
I am also not sure if this breaks things because the quantization PR is not merged yet. There are still a few calls to InferType in the pass but I am not sure they do PI |
sounds good to me, so I think we can add this, and add a special type infer function as @jroesch say. |
1ab051e
to
3725c58
Compare
3725c58
to
55b52bc
Compare
lint update address comment comment out breaking test
lint update address comment comment out breaking test
lint update address comment comment out breaking test
Module will now CHECK that there aren't any free variables/free type variables.
It simplify all passes as they can assume the absence of free variables.
@zhiics @wweic @junrushao1994 can you guys review?