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

[BUGFIX] enable test_fc_subgraph.py::test_fc_eltwise #20393

Merged
merged 2 commits into from
Jun 30, 2021

Conversation

sfraczek
Copy link
Contributor

@sfraczek sfraczek commented Jun 28, 2021

fix numpy activation after fc fuse into subgraph

Description

Enables test_fc_eltwise

Checklist

Essentials

  • PR's title starts with a category (e.g. [BUGFIX], [MODEL], [TUTORIAL], [FEATURE], [DOC], etc)
  • Changes are complete (i.e. I finished coding on this PR)
  • All changes have test coverage

Comments

Fixes second part of issue #20354
Abs of input for square_root operation was introduced because otherwise nan's were in output and asserts wouldn't accept nans on the same positions to be equal even if assert_almost_equal_with_err equal_nan=True

@mxnet-bot
Copy link

Hey @sfraczek , Thanks for submitting the PR
All tests are already queued to run once. If tests fail, you can trigger one or more tests again with the following commands:

  • To trigger all jobs: @mxnet-bot run ci [all]
  • To trigger specific jobs: @mxnet-bot run ci [job1, job2]

CI supported jobs: [centos-gpu, windows-cpu, website, sanity, edge, unix-cpu, clang, miscellaneous, centos-cpu, windows-gpu, unix-gpu]


Note:
Only following 3 categories can trigger CI :PR Author, MXNet Committer, Jenkins Admin.
All CI tests must pass before the PR can be merged.

@mseth10 mseth10 added the pr-awaiting-testing PR is reviewed and waiting CI build and test label Jun 28, 2021
@sfraczek sfraczek changed the title [BUGFIX] issue 20354 fix part 2 [BUGFIX] enable test_fc_subgraph.py::test_fc_eltwise Jun 28, 2021

def _init_weight(self, _, arr):
mx.np.random.normal(self.mean, self.sigma, arr.shape, dtype=arr.dtype, out=arr)
# import pdb
Copy link
Contributor

Choose a reason for hiding this comment

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

remove

#avoid calculating square root of negative values
self.alg = alg

def forward(self, x):
if self.alg == 'square_root':
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add comment why we need abs here

Copy link
Contributor

Choose a reason for hiding this comment

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

Is there any hidden reason besides the fact that square root can take only 0 and positive numbers as argument? It there is not I believe the comment is unnecessary.

Copy link
Contributor Author

@sfraczek sfraczek Jun 28, 2021

Choose a reason for hiding this comment

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

Only that square_root returns nans for negative numbers which fail on assert equals because nan != nan

#avoid calculating square root of negative values
self.alg = alg

def forward(self, x):
if self.alg == 'square_root':
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there any hidden reason besides the fact that square root can take only 0 and positive numbers as argument? It there is not I believe the comment is unnecessary.

matched_list_.push_back(&new_node);
status_ = kSuccess;
return true;
}
if (new_node.op() == Op::Get("abs")) {
if (new_node.op() == Op::Get("abs") ||
new_node.op() == Op::Get("_npi_absolute")) {
Copy link
Contributor

@bartekkuncer bartekkuncer Jun 28, 2021

Choose a reason for hiding this comment

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

If you change something I think it would be nice to put those checks in pairs e.g. if (new_node.op() == Op::Get("abs") || new_node.op() == Op::Get("_npi_absolute")) { or new_node.op() == Op::Get("exp") || new_node.op() == Op::Get("_npi_exp").

Copy link
Contributor Author

@sfraczek sfraczek Jun 28, 2021

Choose a reason for hiding this comment

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

Like this?
image
I prefer it as it is

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, I was thinking about something similar to this. That was just a suggestion so if you do not like it, feel free to ignore it :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok thank you it was worth a try :)

@mseth10 mseth10 added pr-work-in-progress PR is still work in progress pr-awaiting-testing PR is reviewed and waiting CI build and test and removed pr-awaiting-testing PR is reviewed and waiting CI build and test pr-work-in-progress PR is still work in progress labels Jun 28, 2021
fix numpy activation after fc
@mseth10 mseth10 added pr-awaiting-review PR is waiting for code review pr-awaiting-testing PR is reviewed and waiting CI build and test pr-work-in-progress PR is still work in progress and removed pr-awaiting-testing PR is reviewed and waiting CI build and test pr-awaiting-review PR is waiting for code review labels Jun 28, 2021
@akarbown
Copy link
Contributor

@mxnet-bot run ci[unix-cpu]

@mxnet-bot
Copy link

Jenkins CI successfully triggered : [unix-cpu]

@mseth10 mseth10 added pr-awaiting-testing PR is reviewed and waiting CI build and test pr-awaiting-review PR is waiting for code review and removed pr-work-in-progress PR is still work in progress pr-awaiting-testing PR is reviewed and waiting CI build and test labels Jun 29, 2021
@akarbown akarbown merged commit fabcd14 into apache:master Jun 30, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
pr-awaiting-review PR is waiting for code review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants