Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

[MXNET-795] Fix a bug that CutSubgraph works only when each subgraph has its distinct name #12106

Merged
merged 3 commits into from
Aug 22, 2018

Conversation

junrushao
Copy link
Member

@junrushao junrushao commented Aug 9, 2018

Description

This PR fixes a bug in assigning names of subgraphs. The CutSubgraph works as expected only when each subgraph has its unique name.

This PR ensures it by creating a global dict in AttrScope, which is pretty ugly though. I am not aware of any other solutions that could ensure a set of strings to be unique globally. If there is better solution, please let me know. Thanks!

Checklist

Essentials

Please feel free to remove inapplicable items for your PR.

  • The PR title starts with [MXNET-$JIRA_ID], where $JIRA_ID refers to the relevant JIRA issue created (except PRs with tiny changes)
  • Changes are complete (i.e. I finished coding on this PR)
  • All changes have test coverage:
  • Unit tests are added for small changes to verify correctness (e.g. adding a new operator)
  • Nightly tests are added for complicated/long-running ones (e.g. changing distributed kvstore)
  • Build tests will be added for build configuration changes (e.g. adding a new build option with NCCL)
  • Code is well-documented:
  • For user-facing API changes, API doc string has been updated.
  • For new C++ functions in header files, their functionalities and arguments are documented.
  • For new examples, README.md is added to explain the what the example does, the source of the dataset, expected performance on test set and reference to the original paper if applicable
  • Check the API doc at http://mxnet-ci-doc.s3-accelerate.dualstack.amazonaws.com/PR-$PR_ID/$BUILD_ID/index.html
  • To the my best knowledge, examples are either not affected by this change, or have been fixed to be compatible with this change

Changes

  • Add _subgraph_names into AttrScope as static member.

Comments

@junrushao junrushao requested a review from szha as a code owner August 9, 2018 07:58
@junrushao junrushao changed the title Fix a bug that CutSubgraph works only when each subgraph has its distinct name [MXNET-795] Fix a bug that CutSubgraph works only when each subgraph has its distinct name Aug 9, 2018
@junrushao
Copy link
Member Author

It should be merged after #12078

@junrushao junrushao force-pushed the fix-subgraph-duplicate-scope branch from 2d7ffe2 to 20e1eb6 Compare August 9, 2018 16:20
@junrushao
Copy link
Member Author

Could we consider merging this fix, since #12078 has been merged? @zheng-da

@junrushao junrushao force-pushed the fix-subgraph-duplicate-scope branch from 94c2037 to 6c44770 Compare August 10, 2018 20:53
@junrushao
Copy link
Member Author

@zheng-da Could we get this fix merged?

name="my_cond",
)
return new_data
AttrScope._subgraph_names = defaultdict(int)
Copy link
Contributor

Choose a reason for hiding this comment

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

do we need to define this?

Copy link
Member Author

Choose a reason for hiding this comment

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

@zheng-da Note that _subgraph_names are more like a global variable, I add this in case it is changed in other testcases.

Copy link
Contributor

Choose a reason for hiding this comment

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

good point.

@junrushao
Copy link
Member Author

Could we get this merged? @zheng-da

@szha szha merged commit c692ffd into apache:master Aug 22, 2018
@junrushao
Copy link
Member Author

Thank you guys for helping with this PR!

XinYao1994 pushed a commit to XinYao1994/incubator-mxnet that referenced this pull request Aug 29, 2018
…has its distinct name (apache#12106)

* Copy only when necessary

* Fix typo

* Add unittest
anirudh2290 pushed a commit to anirudh2290/mxnet that referenced this pull request Sep 19, 2018
…has its distinct name (apache#12106)

* Copy only when necessary

* Fix typo

* Add unittest
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants