From 47ec22f323427b68a5eb48920b9d98306d2ee24d Mon Sep 17 00:00:00 2001 From: eric-haibin-lin Date: Thu, 18 May 2017 00:59:07 +0000 Subject: [PATCH] fix the rest of TShape constructor errors" --- src/operator/tensor/elemwise_binary_op.h | 2 +- src/operator/tensor/elemwise_unary_op.h | 6 +++--- src/operator/tensor/indexing_op.h | 2 +- src/operator/tensor/matrix_op-inl.h | 2 +- tests/cpp/test_utils.h | 6 +++--- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/operator/tensor/elemwise_binary_op.h b/src/operator/tensor/elemwise_binary_op.h index bb2b187145f0..024b2fec90a7 100644 --- a/src/operator/tensor/elemwise_binary_op.h +++ b/src/operator/tensor/elemwise_binary_op.h @@ -150,7 +150,7 @@ void BinaryComputeRspRsp(const nnvm::NodeAttrs& attrs, // need to subtract the number of common rows unsigned int num_rows_l = lhs.aux_shape(rowsparse::kIdx).Size(); unsigned int num_rows_r = rhs.aux_shape(rowsparse::kIdx).Size(); - output.CheckAndAlloc({TShape({num_rows_l + num_rows_r})}); + output.CheckAndAlloc({mshadow::Shape1(num_rows_l + num_rows_r)}); mshadow::Stream *s = ctx.get_stream(); MSHADOW_TYPE_SWITCH(output.dtype(), DType, { MSHADOW_TYPE_SWITCH(lhs.aux_type(rowsparse::kIdx), IType, { diff --git a/src/operator/tensor/elemwise_unary_op.h b/src/operator/tensor/elemwise_unary_op.h index 379cb9dfd2e0..dcff9531d4d6 100644 --- a/src/operator/tensor/elemwise_unary_op.h +++ b/src/operator/tensor/elemwise_unary_op.h @@ -420,7 +420,7 @@ void CastStorageDnsCsrImpl(mshadow::Stream *s, const TBlob& dns, NDArray* c NDARRAY_IDX_TYPE_SWITCH(csr->aux_type(csr::kIdx), CType, { // col idx type const index_t num_rows = dns.shape_[0]; const index_t num_cols = dns.shape_[1]; - csr->CheckAndAllocAuxData(csr::kIndPtr, TShape({num_rows+1})); + csr->CheckAndAllocAuxData(csr::kIndPtr, mshadow::Shape1(num_rows+1)); IType* indptr = csr->aux_data(csr::kIndPtr).dptr(); DType* dns_data = dns.dptr(); mxnet_op::Kernel::Launch(s, num_rows, indptr, @@ -432,8 +432,8 @@ void CastStorageDnsCsrImpl(mshadow::Stream *s, const TBlob& dns, NDArray* c indptr[i+1] += indptr[i]; } // allocate column idx array and value array - csr->CheckAndAllocAuxData(csr::kIdx, TShape({static_cast(indptr[num_rows])})); - csr->CheckAndAllocData(TShape({static_cast(indptr[num_rows])})); + csr->CheckAndAllocAuxData(csr::kIdx, mshadow::Shape1(static_cast(indptr[num_rows]))); + csr->CheckAndAllocData(mshadow::Shape1(static_cast(indptr[num_rows]))); // fill col_idx and value arrays of the csr mxnet_op::Kernel::Launch(s, num_rows, csr->data().dptr(), csr->aux_data(csr::kIdx).dptr(), diff --git a/src/operator/tensor/indexing_op.h b/src/operator/tensor/indexing_op.h index d71596fe4fa9..b677eedcc6fc 100644 --- a/src/operator/tensor/indexing_op.h +++ b/src/operator/tensor/indexing_op.h @@ -385,7 +385,7 @@ void SparseEmbeddingOpBackwardDnsDnsRsp(const nnvm::NodeAttrs& attrs, << "embedding input index and gradient row sparse type doesn't match!"; // Alloc dense output unsigned int num_rows = output.shape()[0]; - output.CheckAndAlloc({TShape({num_rows})}); + output.CheckAndAlloc({mshadow::Shape1(num_rows)}); MSHADOW_TYPE_SWITCH(output.dtype(), DType, { NDARRAY_IDX_TYPE_SWITCH(idx.dtype(), IType, { MXNET_ASSIGN_REQ_SWITCH(req[1], req_type, { diff --git a/src/operator/tensor/matrix_op-inl.h b/src/operator/tensor/matrix_op-inl.h index 85adf85f0904..5bb27acd3daf 100644 --- a/src/operator/tensor/matrix_op-inl.h +++ b/src/operator/tensor/matrix_op-inl.h @@ -786,7 +786,7 @@ void DotCsrDnsRspImpl(const OpContext& ctx, for (int i = 0; i < static_cast(indptr_l.Size())-1; ++i) { if (indptr[i] < indptr[i+1]) ++nnr; } - ret->CheckAndAlloc({TShape({nnr})}); + ret->CheckAndAlloc({mshadow::Shape1(nnr)}); // fill in row_idx_out (single thread) const TBlob data_out = ret->data(); const TBlob row_idx_out = ret->aux_data(rowsparse::kIdx); diff --git a/tests/cpp/test_utils.h b/tests/cpp/test_utils.h index 7a233039a881..b3df0d8ad2fa 100644 --- a/tests/cpp/test_utils.h +++ b/tests/cpp/test_utils.h @@ -66,13 +66,13 @@ NDArray RspND(const TShape shape, const Context ctx, const std::vector