From 99e4b8ce6dd7417ceca101b84d8a07317771cb1b Mon Sep 17 00:00:00 2001 From: Haibin Lin Date: Sat, 23 Sep 2017 21:46:36 -0700 Subject: [PATCH] fix elemwise_sum test script (#8008) --- src/operator/tensor/elemwise_sum.cu | 4 +--- tests/python/unittest/test_sparse_operator.py | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/operator/tensor/elemwise_sum.cu b/src/operator/tensor/elemwise_sum.cu index aacc1cba7e3b..700ed0ca6e69 100644 --- a/src/operator/tensor/elemwise_sum.cu +++ b/src/operator/tensor/elemwise_sum.cu @@ -39,10 +39,8 @@ void ElementWiseSumComputeExGPU(const nnvm::NodeAttrs& attrs, CHECK_EQ(req[0], kWriteTo) << "ElementWiseSumComputeExGPU only supports req = kWriteTo"; if (inputs[0].storage_type() == kRowSparseStorage) { mshadow::Stream* s = op_ctx.get_stream(); - Resource rsc = ResourceManager::Get()->Request(op_ctx.run_ctx.get_ctx(), - ResourceRequest(ResourceRequest::kTempSpace)); NDArray out_nd = outputs[0]; - mxnet::ndarray::ElementwiseSum(s, rsc, inputs, &out_nd); + mxnet::ndarray::ElementwiseSum(s, op_ctx.requested[0], inputs, &out_nd); } else { FCompExFallback(attrs, op_ctx, inputs, req, outputs, ElementWiseSumComputeWithHalf2, diff --git a/tests/python/unittest/test_sparse_operator.py b/tests/python/unittest/test_sparse_operator.py index 662838cb8bcb..49023d2ca337 100644 --- a/tests/python/unittest/test_sparse_operator.py +++ b/tests/python/unittest/test_sparse_operator.py @@ -1498,8 +1498,8 @@ def check_sparse_elementwise_sum_with_shape(stype, shape, n): inputs = [mx.symbol.Variable('arg%d' % i) for i in range(n)] out = mx.symbol.sparse.add_n(*inputs, name='esum') arr = [] - arr_grad = [mx.nd.empty(shape) for _ in range(n)] - densities = [0, 0.01, 0.1, 0.2, 0.3, 0.4, 0.5, 1.0] + arr_grad = [mx.nd.empty(shape, stype=stype) for _ in range(n)] + densities = [0, 0.01, 0.5, 1.0] for i in range(n): arr.append(rand_ndarray(shape, stype, densities[np.random.randint(0, len(densities))]))