-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Added tests to verify Large Vector Support for initial set of ops #15943
Conversation
@mxnet-label-bot add [pr-work-in-progress] |
99f15e7
to
d7dfc37
Compare
@mxnet-label-bot add [pr-awaiting-review] |
@apeforest @ChaiBapchya this is now ready for review |
f8d5c89
to
44b217b
Compare
229838a
to
661424b
Compare
@apeforest @ChaiBapchya pr is ready for review |
tests/nightly/test_large_vector.py
Outdated
|
||
def test_ndarray_ones(): | ||
a = nd.ones(shape=(LARGE_X)) | ||
assert a[-1][0] == 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a vector. So [0] isn't needed (no 2nd dimension!)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
correct ... it still worked though. Its not right to check in this way. Will correct it !
tests/nightly/test_large_vector.py
Outdated
@with_seed() | ||
def test_ndarray_random_uniform(): | ||
a = nd.random.uniform(shape=LARGE_X) | ||
assert a[-1][0] != 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same!
661424b
to
9bff00f
Compare
Made a note of the skipped tests in this issue. For easy tracking. |
tests/nightly/test_large_vector.py
Outdated
def test_clip(): | ||
a = nd.arange(0, LARGE_X) | ||
res = nd.clip(a, a_min=100, a_max=1000) | ||
assert np.sum(res[-1].asnumpy() == 1000) == 101 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you tested this? Isn't np.sum(res[-1].asnumpy() == 1000) == 1?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
aah ... copy paste error !
tests/nightly/test_large_vector.py
Outdated
assert (indices_2d.asnumpy() == np.array(original_2d_indices)).all() | ||
|
||
|
||
def create_large_vector(size, dtype=np.int64): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move this to the beginning the file before all the test methods if it is for generic use. Even better, put these util methods to a separate file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
c1f2cd0
to
21c13f2
Compare
tests/nightly/test_large_vector.py
Outdated
assert_almost_equal(output.asnumpy(), expected, atol=1e-3, rtol=1e-3) | ||
|
||
|
||
def test_spacetodepth(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why need for 1D test?
tests/nightly/test_large_vector.py
Outdated
assert_almost_equal(output.asnumpy(), expected, atol=1e-3, rtol=1e-3) | ||
|
||
@with_seed() | ||
def test_diag(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why need for 1D test?
tests/nightly/test_large_vector.py
Outdated
|
||
|
||
@with_seed() | ||
def test_ravel_multi_index(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why need for 1D test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed. Please remove tests not for 1D vector. Also, please run through the entire test file and paste the output in PR.
b753fc1
to
51e5d4b
Compare
tests/nightly/test_large_vector.py
Outdated
|
||
def test_topk(): | ||
b = create_vector(size=LARGE_X) | ||
k = nd.topk(b, k=10, axis=0, dtype=np.int64) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would it be more consistent to rename it to ind?
tests/nightly/test_large_vector.py
Outdated
assert np.sum(k.asnumpy() == (LARGE_X - 1)) == 1 | ||
ind, val = mx.nd.topk(b, k=3, axis=0, dtype=np.int64, ret_typ="both", is_ascend=False) | ||
assert np.all(ind == val) | ||
l = nd.topk(b, k=1, axis=0, dtype=np.int64, ret_typ="value") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rename to val
tests/nightly/test_large_vector.py
Outdated
|
||
|
||
def test_softmax(): | ||
input_data = nd.ones((2, LARGE_X)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1D?
tests/nightly/test_large_vector.py
Outdated
|
||
|
||
def test_pick(): | ||
a = mx.nd.ones(shape=(LARGE_X, 2)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1D?
tests/nightly/test_large_vector.py
Outdated
a = nd.random.randint(low_large_value, high_large_value, dtype=np.int64) | ||
low = mx.nd.array([low_large_value], dtype='int64') | ||
high = mx.nd.array([high_large_value], dtype='int64') | ||
assert a.__gt__(low) and a.__lt__(high) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe just a > low and a < high?
Please paste your output here after you run through the test locally. Thanks! |
…ong with new C_Apis supporting 64bit indexing
31b9038
to
154a343
Compare
154a343
to
fb9cdb1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks for the quick response!
@mxnet-label-bot add [pr-awaiting-merge] |
…ache#15943) * Adding tests to verify support for Large Tensors in additional Ops along with new C_Apis supporting 64bit indexing * removing skipped tests * enabling Large Index support for slice and softmax * removing tests not required for vector testing
…ache#15943) * Adding tests to verify support for Large Tensors in additional Ops along with new C_Apis supporting 64bit indexing * removing skipped tests * enabling Large Index support for slice and softmax * removing tests not required for vector testing
…ache#15943) * Adding tests to verify support for Large Tensors in additional Ops along with new C_Apis supporting 64bit indexing * removing skipped tests * enabling Large Index support for slice and softmax * removing tests not required for vector testing
Description
Added Large Index Support for Slice and Softmax Ops and verification of Large Index support in a couple of operators. Extracted Large Vector and Tensor creation helper methods into test_utils.py
Checklist
Essentials
Please feel free to remove inapplicable items for your PR.
Testing
MXNET_TEST_COUNT=1 nosetests --logging-level=DEBUG --verbose -s tests/nightly/test_large_vector.py
/home/ubuntu/anaconda3/lib/python3.6/site-packages/h5py/init.py:36: FutureWarning: Conversion of the second argument of issubdtype from
float
tonp.floating
is deprecated. In future, it will be treated asnp.float64 == np.dtype(float).type
.from ._conv import register_converters as _register_converters
test_large_vector.test_slice ... ok
test_large_vector.test_ndarray_zeros ... ok
test_large_vector.test_ndarray_ones ... ok
test_large_vector.test_ndarray_random_uniform ... [DEBUG] Setting test np/mx/python random seeds, use MXNET_TEST_SEED=1698621242 to reproduce.
ok
test_large_vector.test_ndarray_random_randint ... [DEBUG] Setting test np/mx/python random seeds, use MXNET_TEST_SEED=787222743 to reproduce.
ok
test_large_vector.test_ndarray_empty ... ok
test_large_vector.test_elementwise ... ok
test_large_vector.test_reduce ... ok
test_large_vector.test_clip ... ok
test_large_vector.test_argmin ... ok
test_large_vector.test_take ... ok
test_large_vector.test_slice_assign ... ok
test_large_vector.test_expand_dims ... ok
test_large_vector.test_squeeze ... ok
test_large_vector.test_broadcast_div ... ok
test_large_vector.test_Dense ... ok
test_large_vector.test_argsort ... ok
test_large_vector.test_sort ... ok
test_large_vector.test_topk ... ok
Ran 19 tests in 9905.014s
OK