Fix load subgraph from json#1980
Conversation
|
Hey, it would be great if you can add a unit test(either in python or c++). I personally prefer c++ since the test and implementation will be in the same language and it's easier to debug in the future. |
|
@wweic Thanks for your comment. This is a minor change that just fixing a bug. It's not easy to create a test inside nnvm as the ops containing subgraph attrs are all inside MXNet. Also, I even don't see any tests with subgraphs, I'm not sure if this feature could be tested inside nnvm. |
|
@ZhennanQin Thanks. As the contribution guide said, I think for this fix, if you have the JSON representation of such graph, you can easily call |
|
I understand that improving test coverage is important, and it could protect your change not being broken in future. But as I said, it's difficult to add such a test inside NNVM repo, while it's much easier to add in MXNet. For your suggestion, I could upload the json of my graph that can trigger this bug, but it would parse correctly even before merging my fix. Because the bug is caused from Cached_op parser, which will generate incorrect Cached_op params before this fix. As Cached_op isn't a part of NNVM repo, if I want to add such a test, I guess I need to create a fake Cached_op inside NNVM to simulate its parser behavior, which is a bit over work for such a small bug fix. |
|
@ZhennanQin thanks for the context. That makes a lot more sense to me now. |
|
Thanks @wweic @ZhennanQin for good discussion, given the special case presented here, i will directly merge it |
For a node containing subgraphs attrs, we need to build subgraphs attrs before build attribute parser, as parser may need to access subgraphs attrs.
@zheng-da @pengzhao-intel