Updated debugprint to print variable name for leaf nodes#720
Updated debugprint to print variable name for leaf nodes#720oscargus wants to merge 1 commit intoaesara-devs:mainfrom
debugprint to print variable name for leaf nodes#720Conversation
Variable.debugprint to print variable name for leaf nodes
08f3493 to
59551ab
Compare
Better approach than in aesara-devs#719. Now debugprint use the newly introduced `_debug_str` property (fallback to `str`). This is also used if `name` is not set.
59551ab to
ba27e5f
Compare
|
Unfortunately, we still have some old Theano tests that use the Regardless, these changes are bigger than #689 and would need to be considered as an entirely distinct refactoring of the We can still consider making these changes, but we should change this PR to a draft and start going over the pros/cons of such a change. |
|
Looking at the failed test, it seems like the previous approach was actually in line with what was already these. One may consider scrapping the value though. |
|
I see the parallel with input variables, and in that case the previous PR is just fine. As an enhancement I find the output after this PR more readable, we get the fact that it is a constant, the value, and the optional name. Input variables could likely also be made more readable with the same sort of changes done here for the constants, by showing the type (scalar, vector, matrix, etc) and the optional name after the id. I am not considering implementation/ maintenance challenges though. What do you guys think? |
It has a kind of uniformity I can appreciate, so I'm not against it; however, it seems like we should go all the way with the uniformity and not even use any This approach also works much better with our goal of simplifying the core Aesara objects, since that mostly involves the removal of external information from the instances and types (e.g. ultimately removing all the C compilation-related methods and members). |
|
I like that idea yes. @oscargus is this something you would be interested in trying in this PR? If not feel free to close it and we'll open an issue to keep track of it |
|
I've checked the code base a bit and realized that the usage of Basically, The main question is of course how
If you agree on this, I can definitely start working on it. Edit: maybe one should fallback to |
Yes, this is something that has bothered me for a while. It's even come up in a completely different scenario. We do need to be careful here, though, because—given the nature of our objects (i.e. graphs)—there's the potential for a true "readable"
I'm generally for this, with awareness of the issue mentioned above, of course.
This is fine, and there shouldn't be any issues with cycles. One technically can force a cycle into a graph, but that would be a rather odd intentional effort, so there's really no need to worry about it.
As I mentioned above, it's best that we make the output format of We can use the format already defined by the current generic |
I think that could be a quite nice approach though. Basically because classes could have quite different properties, so different classes may want to print differently. At first glance, I cannot really see any other option than an " (I'm also probably biased from the way that SymPy does it, which I've worked with quite a bit and find to work neatly. On the other hand, it may be that there spread is much larger there when it comes to possible outcomes.) |
All the relevant properties should be available via In other words, we necessarily should be able to implement a uniform debug printing format without using the graph objects (e.g. In general, this library is trying to move toward simpler types and a clearer separation between type/class definitions and functionality that depends on them. You can see this in our (ongoing) move away from the old C backend that promoted a mess of specialized When possible, we prefer to use generic functions/ |
Better approach than in #719. Now debugprint use the newly introduced
_debug_strproperty (fallback tostr). This is also used ifnameis not set.
Now the output is as:
Is this more like you expected @ricardoV94 ?
Thank you for opening a PR!
Here are a few important guidelines and requirements to check before your PR can be merged:
pre-commitis installed and set up.Don't worry, your PR doesn't need to be in perfect order to submit it. As development progresses and/or reviewers request changes, you can always rewrite the history of your feature/PR branches.
If your PR is an ongoing effort and you would like to involve us in the process, simply make it a draft PR.