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

Fix the problem in printing feature in c++ API examples : feature_extract #15686

Merged
merged 5 commits into from
Nov 26, 2019

Conversation

somone23412
Copy link
Contributor

@somone23412 somone23412 commented Jul 29, 2019

Fixed a run-time error caused by mismatch of output dimensions.

Description

The dimensions output with origin code and model is (2, 1024, 1, 1), which may lead to the following errors:

terminate called after throwing an instance of 'dmlc::Error'
  what():  [10:34:56] /mnt/feature_extract/3rdparty/mxnet-cpp-package/include/mxnet-cpp/ndarray.hpp:379: Check failed: shape.size() == 2 (4 vs. 2) : The NDArray needs to be 2 dimensional.

so we should reshape the output array to (2, 1024)

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:https://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

Fixed a run-time error caused by mismatch of output dimensions.
@somone23412 somone23412 requested a review from nswamy as a code owner July 29, 2019 10:51
@piyushghai
Copy link
Contributor

Thanks for your contributions @somone23412 .
@leleamol Can you review this PR as well?

@mxnet-label-bot add [pr-awaiting-review, C++]

@marcoabreu marcoabreu added C++ Related to C++ pr-awaiting-review PR is waiting for code review labels Jul 31, 2019
@karan6181
Copy link
Contributor

@leleamol Gentle Ping ..

@wkcn wkcn merged commit c9585bd into apache:master Nov 26, 2019
@wkcn
Copy link
Member

wkcn commented Nov 26, 2019

Merged. Thanks for your contribution!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
C++ Related to C++ pr-awaiting-review PR is waiting for code review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants