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

[MXNET-1422] Fix wrong results of min([inf, inf]) and max([-inf,-inf]) #16226

Merged
merged 3 commits into from
Sep 20, 2019

Conversation

wkcn
Copy link
Member

@wkcn wkcn commented Sep 20, 2019

Description

Hi, there.
In the latest version of MXNet, the results of min([inf, inf]) and max([-inf, -inf]) are wrong. #16206 .
The reason is that the initial values of minimum or maximum reducer are the MaxValue and the MinValue. They should be the +InfValue and the -InfValue.

In this PR, I add PosInfValue and NegInfValue in mshadow. Then I fixed the bug.

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 PosInfValue and NegInfValue in mshadow
  • Modify the initial value of minimum and maximum reducer.
  • Add the relative unittest.

@wkcn wkcn changed the title Fix wrong results of min([inf, inf]) and max([-inf,-inf]) [MXNET-1422] Fix wrong results of min([inf, inf]) and max([-inf,-inf]) Sep 20, 2019
@wkcn wkcn added Bug Backend Issues related to the backend of MXNet Operator labels Sep 20, 2019
@marcoabreu marcoabreu merged commit 618c481 into apache:master Sep 20, 2019
drivanov pushed a commit to drivanov/incubator-mxnet that referenced this pull request Sep 26, 2019
apache#16226)

* fix min max infinity value

* add test maximum

* use HUGE_VAL macro for nvcc
larroy pushed a commit to larroy/mxnet that referenced this pull request Sep 28, 2019
apache#16226)

* fix min max infinity value

* add test maximum

* use HUGE_VAL macro for nvcc
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Backend Issues related to the backend of MXNet Bug Operator
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants