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

NPE in BucketingModule when providedLabel of DataBatch is not set #11790

Merged
merged 1 commit into from
Jul 18, 2018

Conversation

milandesai
Copy link
Contributor

Description

Using BucketingModule together with a DataBatch in which the provideLabel field is not set triggers a NullPointerException in BucketingModule.forward(...). This happens because the implicit method ListMap2Descs tries to convert ListMap[String, Shape] into IndexedSeq[DataDesc] but fails because the former is null by default. A simple fix is to do a null check in the implicit method.

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

  • Feature1, tests, (and when applicable, API doc)
  • Feature2, tests, (and when applicable, API doc)

Comments

  • If this change is a backward incompatible change, why must this change be made.
  • Interesting edge cases to note here

@milandesai
Copy link
Contributor Author

@lupesko @nswamy

@nswamy
Copy link
Member

nswamy commented Jul 18, 2018

@milandesai Thanks for the quick fix, @lanking520 also suggested the same fix. This will work for now, we are discussing to add new APIs(alike provideData and provideShape) to take Option[IndexedSeq[DataDesc]] in DataIter and remove the implicit def ListMap2Descs, it is also causing other problems, for example not considering the layout of the input. For RNN it is required to know whether it is the NTC or TNC format. I'll keep you posted once we have a proper solution in place aswell.

@nswamy nswamy merged commit 6abfc70 into apache:master Jul 18, 2018
@lupesko
Copy link
Contributor

lupesko commented Jul 18, 2018

@milandesai thanks for your contribution. A unit test would be great...

KellenSunderland pushed a commit to KellenSunderland/incubator-mxnet that referenced this pull request Jul 19, 2018
…ache#11790)

NPE in BucketingModule when providedLabel of DataBatch is not set
KellenSunderland pushed a commit to KellenSunderland/incubator-mxnet that referenced this pull request Jul 21, 2018
…ache#11790)

NPE in BucketingModule when providedLabel of DataBatch is not set
@nswamy
Copy link
Member

nswamy commented Jul 25, 2018

Closing this issue in favor of #11878

@milandesai milandesai deleted the fix-datadesc-npe branch July 28, 2018 06:01
XinYao1994 pushed a commit to XinYao1994/incubator-mxnet that referenced this pull request Aug 29, 2018
…ache#11790)

NPE in BucketingModule when providedLabel of DataBatch is not set
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