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

print ast w/o metadata #2533

Merged
merged 3 commits into from
Feb 3, 2019
Merged

print ast w/o metadata #2533

merged 3 commits into from
Feb 3, 2019

Conversation

zhiics
Copy link
Member

@zhiics zhiics commented Feb 1, 2019

As described in #2461 , we want to have a separate Print function in C++ and overloaded __str__ in python to omit metadata when print relay nodes.

CC' @tqchen, @ZihengJiang, @jroesch, @yzhliu please review. Thanks.

* additional comment block to an expr.
* \return The text representation.
*/
std::string Print(const NodeRef& node,
Copy link
Member

Choose a reason for hiding this comment

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

Let us simply overload operator<< for relayExpr in this case.

Copy link
Member Author

Choose a reason for hiding this comment

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

@tqchen Yeah, I tried overloading before, but there is already an overloaded one here: https://github.com/dmlc/tvm/blob/master/src/lang/expr.cc#L46 So I simply used Print.

Copy link
Member Author

Choose a reason for hiding this comment

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

@tqchen Sorry, you were saying Expr. That should work. I will update the PR.

Copy link
Member

Choose a reason for hiding this comment

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

Are we sure we want to have default be the pretty-printed version of the program? It is valuable to the debug representation as well, how do we do that?

Copy link
Member Author

@zhiics zhiics Feb 1, 2019

Choose a reason for hiding this comment

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

@jroesch I agree that metadata can be useful for debugging, but I think pretty-printing could probably provide enough information most of the time if I understand correctly. People can still have the detailed information using the previous way for debugging if needed.
@tqchen @ZihengJiang thoughts?

Copy link
Member

Choose a reason for hiding this comment

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

If you feel that there is a need to avoid c++ printing for now. we can first remove the operator<< in C++ and only land the python side of changes

@tqchen
Copy link
Member

tqchen commented Feb 2, 2019

@zhiics can you remove the << in C++ for now and let us first merge in the python side, which is the mostly convenient part?

@zhiics
Copy link
Member Author

zhiics commented Feb 2, 2019

@tqchen Removed. Please take another look. Thanks.

@tqchen
Copy link
Member

tqchen commented Feb 3, 2019

@tqchen
Copy link
Member

tqchen commented Feb 3, 2019

@zhiics need rebase

@zhiics
Copy link
Member Author

zhiics commented Feb 3, 2019

@tqchen rebased.

@tqchen tqchen merged commit 0f2e432 into apache:master Feb 3, 2019
@tqchen
Copy link
Member

tqchen commented Feb 3, 2019

Thanks, @zhiics @jroesch this is now merged

libing4752 pushed a commit to libing4752/tvm that referenced this pull request Feb 18, 2019
merrymercy pushed a commit to merrymercy/tvm that referenced this pull request Feb 18, 2019
@zhiics zhiics deleted the relay_print branch February 19, 2019 06:00
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
@yzhliu yzhliu mentioned this pull request Mar 2, 2019
28 tasks
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