[GitHub] [incubator-mxnet] access2rohit commented on a change in pull request #16476: added large tensor support for add_n and tests for more ops
access2rohit commented on a change in pull request #16476: added large tensor support for add_n and tests for more ops URL: https://github.com/apache/incubator-mxnet/pull/16476#discussion_r336315621 ## File path: tests/nightly/test_large_vector.py ## @@ -708,6 +709,57 @@ def test_full(): assert a[-1] == 3 +def test_load_save(): +x = create_vector(size=LARGE_X) +nd.save('large_vector', [x]) +y = nd.load('large_vector') +y = y[0] +assert x[0] == y[0] +assert x[-1] == y[-1] +os.remove('large_vector') + + +def test_add_n(): +x = [nd.ones(LARGE_X)] +y = nd.add_n(*x) +assert y[0] == 1 +assert y[-1] == 1 + + +def test_modulo(): +x = mx.nd.ones(LARGE_X)*6 +y = mx.nd.ones(LARGE_X)*4 +z = (x%y) +assert z[0] == 2 +assert z[-1] == 2 +x = mx.nd.ones(LARGE_X)*5 +z = nd.modulo(x,y) +assert z[0] == 1 +assert z[-1] == 1 + + +def test_maximum(): +x = mx.nd.ones(LARGE_X)*3 +y = mx.nd.ones(LARGE_X)*4 +z = nd.maximum(x, y) +assert z[0] == 4 +assert z[-1] == 4 +z = nd.maximum(x, 5) +assert z[0] == 5 +assert z[-1] == 5 + + +def test_minimum(): +x = mx.nd.ones(LARGE_X)*3 +y = mx.nd.ones(LARGE_X)*2 +z = nd.minimum(x, y) +assert z[0] == 2 +assert z[-1] == 2 +z = nd.minimum(x, 5) +assert z[0] == 3 +assert z[-1] == 3 Review comment: I have to write that. Currently we don't have any docs explaining how to use large tensor support and caveats along with limitations and perf regressions. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] access2rohit commented on a change in pull request #16476: added large tensor support for add_n and tests for more ops
access2rohit commented on a change in pull request #16476: added large tensor support for add_n and tests for more ops URL: https://github.com/apache/incubator-mxnet/pull/16476#discussion_r336134272 ## File path: tests/nightly/test_large_array.py ## @@ -1199,6 +1200,57 @@ def test_full(): assert a[-1][-1] == 3 +def test_load_save(): +x = create_2d_tensor(SMALL_Y, LARGE_X) +nd.save('large_tensor', [x]) +y = nd.load('large_tensor') +y = y[0] +assert x[0][0] == y[0][0] +assert x[-1][-1]== y[-1][-1] +os.remove('large_tensor') + + +def test_add_n(): +x = [nd.ones(LARGE_X) for j in range(SMALL_Y)] +y = nd.add_n(*x) +assert y[0] == SMALL_Y +assert y[-1] == SMALL_Y + + +def test_modulo(): +x = mx.nd.ones((SMALL_Y, LARGE_X))*6 +y = mx.nd.ones(LARGE_X)*4 +z = (x%y) +assert z[0][0] == 2 +assert z[-1][-1] == 2 +x = mx.nd.ones((SMALL_Y, LARGE_X))*5 +z = nd.modulo(x,y) +assert z[0][0] == 1 +assert z[-1][-1] == 1 + + +def test_maximum(): +x = mx.nd.ones((SMALL_Y, LARGE_X))*3 Review comment: @ChaiBapchya Did you know this works or not? https://mxnet.apache.org/api/python/docs/api/ndarray/ndarray.html#mxnet.ndarray.ones gives the following error: ` >>> x = mx.nd.ones(2, 1)*3 Traceback (most recent call last): File "", line 1, in File "/home/ubuntu/incubator-mxnet/python/mxnet/ndarray/ndarray.py", line 3162, in ones return _internal._ones(shape=shape, ctx=ctx, dtype=dtype, **kwargs) File "", line 36, in _ones File "/home/ubuntu/incubator-mxnet/python/mxnet/_ctypes/ndarray.py", line 107, in _imperative_invoke ctypes.byref(out_stypes))) File "/home/ubuntu/incubator-mxnet/python/mxnet/base.py", line 254, in check_call raise MXNetError(py_str(_LIB.MXGetLastError())) mxnet.base.MXNetError: [17:31:04] include/mxnet/./base.h:526: Invalid context string 1 Stack trace: [bt] (0) /home/ubuntu/incubator-mxnet/python/mxnet/../../lib/libmxnet.so(dmlc::LogMessageFatal::~LogMessageFatal()+0x34) [0x7f3f4fe284c6] [bt] (1) /home/ubuntu/incubator-mxnet/python/mxnet/../../lib/libmxnet.so(mxnet::Context::FromString(std::__cxx11::basic_string, std::allocator > const&)+0x4d9) [0x7f3f545699c9] [bt] (2) /home/ubuntu/incubator-mxnet/python/mxnet/../../lib/libmxnet.so(mxnet::imperative::GetContext(nnvm::NodeAttrs const&, std::vector > const&, std::vector > const&, mxnet::Context const&)+0x414) [0x7f3f54569e1d] [bt] (3) /home/ubuntu/incubator-mxnet/python/mxnet/../../lib/libmxnet.so(mxnet::Imperative::Invoke(mxnet::Context const&, nnvm::NodeAttrs const&, std::vector > const&, std::vector > const&)+0x250) [0x7f3f5457030c] [bt] (4) /home/ubuntu/incubator-mxnet/python/mxnet/../../lib/libmxnet.so(MXImperativeInvokeImpl(void*, int, void**, int*, void***, int, char const**, char const**)+0x195) [0x7f3f54eedf89] [bt] (5) /home/ubuntu/incubator-mxnet/python/mxnet/../../lib/libmxnet.so(MXImperativeInvokeEx+0x87) [0x7f3f54eee2fa] [bt] (6) /home/ubuntu/anaconda3/lib/python3.6/lib-dynload/../../libffi.so.6(ffi_call_unix64+0x4c) [0x7f3f5dedbec0] [bt] (7) /home/ubuntu/anaconda3/lib/python3.6/lib-dynload/../../libffi.so.6(ffi_call+0x22d) [0x7f3f5dedb87d] [bt] (8) /home/ubuntu/anaconda3/lib/python3.6/lib-dynload/_ctypes.cpython-36m-x86_64-linux-gnu.so(_ctypes_callproc+0x2ce) [0x7f3f5e0f0dee] ` This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] access2rohit commented on a change in pull request #16476: added large tensor support for add_n and tests for more ops
access2rohit commented on a change in pull request #16476: added large tensor support for add_n and tests for more ops URL: https://github.com/apache/incubator-mxnet/pull/16476#discussion_r336134697 ## File path: tests/nightly/test_large_vector.py ## @@ -708,6 +709,57 @@ def test_full(): assert a[-1] == 3 +def test_load_save(): +x = create_vector(size=LARGE_X) +nd.save('large_vector', [x]) +y = nd.load('large_vector') +y = y[0] +assert x[0] == y[0] +assert x[-1] == y[-1] +os.remove('large_vector') + + +def test_add_n(): +x = [nd.ones(LARGE_X)] +y = nd.add_n(*x) +assert y[0] == 1 +assert y[-1] == 1 + + +def test_modulo(): +x = mx.nd.ones(LARGE_X)*6 +y = mx.nd.ones(LARGE_X)*4 +z = (x%y) Review comment: readability ... it works fine without it too This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] access2rohit commented on a change in pull request #16476: added large tensor support for add_n and tests for more ops
access2rohit commented on a change in pull request #16476: added large tensor support for add_n and tests for more ops URL: https://github.com/apache/incubator-mxnet/pull/16476#discussion_r336134272 ## File path: tests/nightly/test_large_array.py ## @@ -1199,6 +1200,57 @@ def test_full(): assert a[-1][-1] == 3 +def test_load_save(): +x = create_2d_tensor(SMALL_Y, LARGE_X) +nd.save('large_tensor', [x]) +y = nd.load('large_tensor') +y = y[0] +assert x[0][0] == y[0][0] +assert x[-1][-1]== y[-1][-1] +os.remove('large_tensor') + + +def test_add_n(): +x = [nd.ones(LARGE_X) for j in range(SMALL_Y)] +y = nd.add_n(*x) +assert y[0] == SMALL_Y +assert y[-1] == SMALL_Y + + +def test_modulo(): +x = mx.nd.ones((SMALL_Y, LARGE_X))*6 +y = mx.nd.ones(LARGE_X)*4 +z = (x%y) +assert z[0][0] == 2 +assert z[-1][-1] == 2 +x = mx.nd.ones((SMALL_Y, LARGE_X))*5 +z = nd.modulo(x,y) +assert z[0][0] == 1 +assert z[-1][-1] == 1 + + +def test_maximum(): +x = mx.nd.ones((SMALL_Y, LARGE_X))*3 Review comment: @ChaiBapchya Did you know this works or not? gives the following error: ` >>> x = mx.nd.ones(2, 1)*3 Traceback (most recent call last): File "", line 1, in File "/home/ubuntu/incubator-mxnet/python/mxnet/ndarray/ndarray.py", line 3162, in ones return _internal._ones(shape=shape, ctx=ctx, dtype=dtype, **kwargs) File "", line 36, in _ones File "/home/ubuntu/incubator-mxnet/python/mxnet/_ctypes/ndarray.py", line 107, in _imperative_invoke ctypes.byref(out_stypes))) File "/home/ubuntu/incubator-mxnet/python/mxnet/base.py", line 254, in check_call raise MXNetError(py_str(_LIB.MXGetLastError())) mxnet.base.MXNetError: [17:31:04] include/mxnet/./base.h:526: Invalid context string 1 Stack trace: [bt] (0) /home/ubuntu/incubator-mxnet/python/mxnet/../../lib/libmxnet.so(dmlc::LogMessageFatal::~LogMessageFatal()+0x34) [0x7f3f4fe284c6] [bt] (1) /home/ubuntu/incubator-mxnet/python/mxnet/../../lib/libmxnet.so(mxnet::Context::FromString(std::__cxx11::basic_string, std::allocator > const&)+0x4d9) [0x7f3f545699c9] [bt] (2) /home/ubuntu/incubator-mxnet/python/mxnet/../../lib/libmxnet.so(mxnet::imperative::GetContext(nnvm::NodeAttrs const&, std::vector > const&, std::vector > const&, mxnet::Context const&)+0x414) [0x7f3f54569e1d] [bt] (3) /home/ubuntu/incubator-mxnet/python/mxnet/../../lib/libmxnet.so(mxnet::Imperative::Invoke(mxnet::Context const&, nnvm::NodeAttrs const&, std::vector > const&, std::vector > const&)+0x250) [0x7f3f5457030c] [bt] (4) /home/ubuntu/incubator-mxnet/python/mxnet/../../lib/libmxnet.so(MXImperativeInvokeImpl(void*, int, void**, int*, void***, int, char const**, char const**)+0x195) [0x7f3f54eedf89] [bt] (5) /home/ubuntu/incubator-mxnet/python/mxnet/../../lib/libmxnet.so(MXImperativeInvokeEx+0x87) [0x7f3f54eee2fa] [bt] (6) /home/ubuntu/anaconda3/lib/python3.6/lib-dynload/../../libffi.so.6(ffi_call_unix64+0x4c) [0x7f3f5dedbec0] [bt] (7) /home/ubuntu/anaconda3/lib/python3.6/lib-dynload/../../libffi.so.6(ffi_call+0x22d) [0x7f3f5dedb87d] [bt] (8) /home/ubuntu/anaconda3/lib/python3.6/lib-dynload/_ctypes.cpython-36m-x86_64-linux-gnu.so(_ctypes_callproc+0x2ce) [0x7f3f5e0f0dee] ` This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] access2rohit commented on a change in pull request #16476: added large tensor support for add_n and tests for more ops
access2rohit commented on a change in pull request #16476: added large tensor support for add_n and tests for more ops URL: https://github.com/apache/incubator-mxnet/pull/16476#discussion_r336134272 ## File path: tests/nightly/test_large_array.py ## @@ -1199,6 +1200,57 @@ def test_full(): assert a[-1][-1] == 3 +def test_load_save(): +x = create_2d_tensor(SMALL_Y, LARGE_X) +nd.save('large_tensor', [x]) +y = nd.load('large_tensor') +y = y[0] +assert x[0][0] == y[0][0] +assert x[-1][-1]== y[-1][-1] +os.remove('large_tensor') + + +def test_add_n(): +x = [nd.ones(LARGE_X) for j in range(SMALL_Y)] +y = nd.add_n(*x) +assert y[0] == SMALL_Y +assert y[-1] == SMALL_Y + + +def test_modulo(): +x = mx.nd.ones((SMALL_Y, LARGE_X))*6 +y = mx.nd.ones(LARGE_X)*4 +z = (x%y) +assert z[0][0] == 2 +assert z[-1][-1] == 2 +x = mx.nd.ones((SMALL_Y, LARGE_X))*5 +z = nd.modulo(x,y) +assert z[0][0] == 1 +assert z[-1][-1] == 1 + + +def test_maximum(): +x = mx.nd.ones((SMALL_Y, LARGE_X))*3 Review comment: @ChaiBapchya Did you know this wroks or not? gives the following error: ` >>> x = mx.nd.ones(2, 1)*3 Traceback (most recent call last): File "", line 1, in File "/home/ubuntu/incubator-mxnet/python/mxnet/ndarray/ndarray.py", line 3162, in ones return _internal._ones(shape=shape, ctx=ctx, dtype=dtype, **kwargs) File "", line 36, in _ones File "/home/ubuntu/incubator-mxnet/python/mxnet/_ctypes/ndarray.py", line 107, in _imperative_invoke ctypes.byref(out_stypes))) File "/home/ubuntu/incubator-mxnet/python/mxnet/base.py", line 254, in check_call raise MXNetError(py_str(_LIB.MXGetLastError())) mxnet.base.MXNetError: [17:31:04] include/mxnet/./base.h:526: Invalid context string 1 Stack trace: [bt] (0) /home/ubuntu/incubator-mxnet/python/mxnet/../../lib/libmxnet.so(dmlc::LogMessageFatal::~LogMessageFatal()+0x34) [0x7f3f4fe284c6] [bt] (1) /home/ubuntu/incubator-mxnet/python/mxnet/../../lib/libmxnet.so(mxnet::Context::FromString(std::__cxx11::basic_string, std::allocator > const&)+0x4d9) [0x7f3f545699c9] [bt] (2) /home/ubuntu/incubator-mxnet/python/mxnet/../../lib/libmxnet.so(mxnet::imperative::GetContext(nnvm::NodeAttrs const&, std::vector > const&, std::vector > const&, mxnet::Context const&)+0x414) [0x7f3f54569e1d] [bt] (3) /home/ubuntu/incubator-mxnet/python/mxnet/../../lib/libmxnet.so(mxnet::Imperative::Invoke(mxnet::Context const&, nnvm::NodeAttrs const&, std::vector > const&, std::vector > const&)+0x250) [0x7f3f5457030c] [bt] (4) /home/ubuntu/incubator-mxnet/python/mxnet/../../lib/libmxnet.so(MXImperativeInvokeImpl(void*, int, void**, int*, void***, int, char const**, char const**)+0x195) [0x7f3f54eedf89] [bt] (5) /home/ubuntu/incubator-mxnet/python/mxnet/../../lib/libmxnet.so(MXImperativeInvokeEx+0x87) [0x7f3f54eee2fa] [bt] (6) /home/ubuntu/anaconda3/lib/python3.6/lib-dynload/../../libffi.so.6(ffi_call_unix64+0x4c) [0x7f3f5dedbec0] [bt] (7) /home/ubuntu/anaconda3/lib/python3.6/lib-dynload/../../libffi.so.6(ffi_call+0x22d) [0x7f3f5dedb87d] [bt] (8) /home/ubuntu/anaconda3/lib/python3.6/lib-dynload/_ctypes.cpython-36m-x86_64-linux-gnu.so(_ctypes_callproc+0x2ce) [0x7f3f5e0f0dee] ` This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] access2rohit commented on a change in pull request #16476: added large tensor support for add_n and tests for more ops
access2rohit commented on a change in pull request #16476: added large tensor support for add_n and tests for more ops URL: https://github.com/apache/incubator-mxnet/pull/16476#discussion_r335790069 ## File path: tests/nightly/test_large_array.py ## @@ -1199,6 +1200,57 @@ def test_full(): assert a[-1][-1] == 3 +def test_load_save(): +x = create_2d_tensor(SMALL_Y, LARGE_X) +nd.save('large_tensor', [x]) +y = nd.load('large_tensor') +y = y[0] +assert x[0][0] == y[0][0] +assert x[-1][-1]== y[-1][-1] +os.remove('large_tensor') Review comment: done This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] access2rohit commented on a change in pull request #16476: added large tensor support for add_n and tests for more ops
access2rohit commented on a change in pull request #16476: added large tensor support for add_n and tests for more ops URL: https://github.com/apache/incubator-mxnet/pull/16476#discussion_r335789956 ## File path: tests/nightly/test_large_vector.py ## @@ -708,6 +709,57 @@ def test_full(): assert a[-1] == 3 +def test_load_save(): +x = create_vector(size=LARGE_X) +nd.save('large_vector', [x]) +y = nd.load('large_vector') +y = y[0] +assert x[0] == y[0] +assert x[-1] == y[-1] +os.remove('large_vector') + + +def test_add_n(): +x = [nd.ones(LARGE_X)] +y = nd.add_n(*x) +assert y[0] == 1 +assert y[-1] == 1 + + +def test_modulo(): +x = mx.nd.ones(LARGE_X)*6 +y = mx.nd.ones(LARGE_X)*4 +z = (x%y) +assert z[0] == 2 +assert z[-1] == 2 +x = mx.nd.ones(LARGE_X)*5 +z = nd.modulo(x,y) +assert z[0] == 1 +assert z[-1] == 1 + + +def test_maximum(): +x = mx.nd.ones(LARGE_X)*3 +y = mx.nd.ones(LARGE_X)*4 +z = nd.maximum(x, y) +assert z[0] == 4 +assert z[-1] == 4 +z = nd.maximum(x, 5) +assert z[0] == 5 +assert z[-1] == 5 + + +def test_minimum(): +x = mx.nd.ones(LARGE_X)*3 +y = mx.nd.ones(LARGE_X)*2 +z = nd.minimum(x, y) +assert z[0] == 2 +assert z[-1] == 2 +z = nd.minimum(x, 5) +assert z[0] == 3 +assert z[-1] == 3 Review comment: Only forward passes are required by DGL. So only forward passes are tested. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] access2rohit commented on a change in pull request #16476: added large tensor support for add_n and tests for more ops
access2rohit commented on a change in pull request #16476: added large tensor support for add_n and tests for more ops URL: https://github.com/apache/incubator-mxnet/pull/16476#discussion_r335789995 ## File path: src/operator/tensor/elemwise_sum.h ## @@ -64,7 +64,7 @@ void ElementWiseSumCompute_(const nnvm::NodeAttrs& attrs, size_t size = in_data.size(); Stream *s = ctx.get_stream(); DType* out_dptr = out_data[0].dptr(); - int out_size = static_cast((out_data[0].Size() + DataType::kLanes - 1) + index_t out_size = static_cast((out_data[0].Size() + DataType::kLanes - 1) Review comment: yes This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [incubator-mxnet] access2rohit commented on a change in pull request #16476: added large tensor support for add_n and tests for more ops
access2rohit commented on a change in pull request #16476: added large tensor support for add_n and tests for more ops URL: https://github.com/apache/incubator-mxnet/pull/16476#discussion_r335789956 ## File path: tests/nightly/test_large_vector.py ## @@ -708,6 +709,57 @@ def test_full(): assert a[-1] == 3 +def test_load_save(): +x = create_vector(size=LARGE_X) +nd.save('large_vector', [x]) +y = nd.load('large_vector') +y = y[0] +assert x[0] == y[0] +assert x[-1] == y[-1] +os.remove('large_vector') + + +def test_add_n(): +x = [nd.ones(LARGE_X)] +y = nd.add_n(*x) +assert y[0] == 1 +assert y[-1] == 1 + + +def test_modulo(): +x = mx.nd.ones(LARGE_X)*6 +y = mx.nd.ones(LARGE_X)*4 +z = (x%y) +assert z[0] == 2 +assert z[-1] == 2 +x = mx.nd.ones(LARGE_X)*5 +z = nd.modulo(x,y) +assert z[0] == 1 +assert z[-1] == 1 + + +def test_maximum(): +x = mx.nd.ones(LARGE_X)*3 +y = mx.nd.ones(LARGE_X)*4 +z = nd.maximum(x, y) +assert z[0] == 4 +assert z[-1] == 4 +z = nd.maximum(x, 5) +assert z[0] == 5 +assert z[-1] == 5 + + +def test_minimum(): +x = mx.nd.ones(LARGE_X)*3 +y = mx.nd.ones(LARGE_X)*2 +z = nd.minimum(x, y) +assert z[0] == 2 +assert z[-1] == 2 +z = nd.minimum(x, 5) +assert z[0] == 3 +assert z[-1] == 3 Review comment: Only forward passes are required by DGL This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services