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

[MXNET-1400]adding large tensor support tests for depth_to_space and space_to_depth #14797

Merged
merged 1 commit into from
May 9, 2019

Conversation

access2rohit
Copy link
Contributor

@access2rohit access2rohit commented Apr 25, 2019

Description

This PR adds large tensor test cases for 2 more ops mentioned in the title.

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

@access2rohit
Copy link
Contributor Author

@mxnet-label-bot add [pr-awaiting-review]

@marcoabreu marcoabreu added the pr-awaiting-review PR is waiting for code review label Apr 25, 2019
@access2rohit
Copy link
Contributor Author

@apeforest : please review

data_np = data.asnumpy()
output = mx.nd.depth_to_space(data, 2)

def test_spacetodepth():
Copy link
Contributor

Choose a reason for hiding this comment

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

what are you testing here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Have added test cases to compare with numpy implementation

@@ -185,7 +186,19 @@ def test_pick():
b = mx.nd.ones(shape=(256*35,))
res = mx.nd.pick(a,b)
assert res.shape == b.shape


def test_depthtospace():
Copy link
Contributor

Choose a reason for hiding this comment

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

what are you testing here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Have added test cases to compare with numpy implementation

Copy link
Contributor

Choose a reason for hiding this comment

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

nit: rename to test_depth_to_space

data = rand_ndarray(shape_inp, 'default')
data_np = data.asnumpy()
output = mx.nd.space_to_depth(data, 2)
mx.nd.waitall()
Copy link
Contributor

Choose a reason for hiding this comment

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

no need waitall here. You can use output.asnumpy()



def test_depthtospace():
def f(x, blocksize):
Copy link
Contributor

Choose a reason for hiding this comment

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

What does this method do? Use a meaningful name.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have updated the names of the function

assert_almost_equal(output.asnumpy(), expected, atol=1e-3, rtol=1e-3)

def test_spacetodepth():
def f(x, blocksize):
Copy link
Contributor

Choose a reason for hiding this comment

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

What does this method do? Use a meaningful name.

Copy link
Contributor Author

@access2rohit access2rohit Apr 26, 2019

Choose a reason for hiding this comment

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

I have updated the names of the function



def test_depthtospace():
def depthtospace_using_numpy(x, blocksize):
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: rename to numpy_depth_to_space

assert_almost_equal(output.asnumpy(), expected, atol=1e-3, rtol=1e-3)

def test_spacetodepth():
def spacetodepth_using_numpy(x, blocksize):
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: rename to numpy_space_to_depth

@access2rohit access2rohit changed the title adding large tensor support tests for depth_to_space and space_to_depth [MXNET-1400]adding large tensor support tests for depth_to_space and space_to_depth May 8, 2019
@access2rohit
Copy link
Contributor Author

@mxnet-label-bot add [pr-awaiting-merge]

@marcoabreu marcoabreu added the pr-awaiting-merge Review and CI is complete. Ready to Merge label May 8, 2019
@apeforest apeforest merged commit 8dddac0 into apache:master May 9, 2019
haohuanw pushed a commit to haohuanw/incubator-mxnet that referenced this pull request Jun 23, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
pr-awaiting-merge Review and CI is complete. Ready to Merge pr-awaiting-review PR is waiting for code review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants