You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by cj...@apache.org on 2018/03/27 18:11:40 UTC

[incubator-mxnet] branch master updated: [MXNET-144] Fix test_sparse_quadratic_function test (#10259)

This is an automated email from the ASF dual-hosted git repository.

cjolivier01 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git


The following commit(s) were added to refs/heads/master by this push:
     new 0a92e38  [MXNET-144] Fix test_sparse_quadratic_function test (#10259)
0a92e38 is described below

commit 0a92e38c78e14520190d061fcd659809b471da6d
Author: Haibin Lin <li...@gmail.com>
AuthorDate: Tue Mar 27 11:11:29 2018 -0700

    [MXNET-144] Fix test_sparse_quadratic_function test (#10259)
    
    * Add stream to a few FlatTo1D() calls
    
    * fix build
    
    * use enum in storage_initailized() in ndarray
---
 include/mxnet/ndarray.h                 | 4 ++--
 src/operator/contrib/quadratic_op-inl.h | 8 ++++----
 src/operator/mxnet_op.h                 | 2 +-
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/include/mxnet/ndarray.h b/include/mxnet/ndarray.h
index 6cd88a7..b8b7f20 100644
--- a/include/mxnet/ndarray.h
+++ b/include/mxnet/ndarray.h
@@ -279,12 +279,12 @@ class NDArray {
       CHECK_EQ(aux_shape(rowsparse::kIdx)[0], storage_shape()[0])
                << "inconsistent storage shape " << storage_shape()
                << " vs. aux shape " << aux_shape(rowsparse::kIdx);
-      return aux_shape(0).Size() != 0;
+      return aux_shape(rowsparse::kIdx).Size() != 0;
     } else if (stype == kCSRStorage) {
       CHECK_EQ(aux_shape(csr::kIdx)[0], storage_shape()[0])
                << "inconsistent storage shape " << storage_shape()
                << " vs. aux shape " << aux_shape(csr::kIdx);
-      return aux_shape(0).Size() != 0;
+      return aux_shape(csr::kIdx).Size() != 0;
     } else {
       LOG(FATAL) << "Unknown storage type";
     }
diff --git a/src/operator/contrib/quadratic_op-inl.h b/src/operator/contrib/quadratic_op-inl.h
index fe47781..71cb76a 100644
--- a/src/operator/contrib/quadratic_op-inl.h
+++ b/src/operator/contrib/quadratic_op-inl.h
@@ -169,10 +169,10 @@ void QuadraticOpForwardCsrImpl(const QuadraticParam& param,
         Kernel<quadratic_forward<req_type>, xpu>::Launch(
             s, nnz, output.data().dptr<DType>(), input.data().dptr<DType>(),
             param.a, param.b, param.c);
-        Copy(output.aux_data(kIdx).FlatTo1D<xpu, IType>(),
-             input.aux_data(kIdx).FlatTo1D<xpu, IType>(), s);
-        Copy(output.aux_data(kIndPtr).FlatTo1D<xpu, IType>(),
-             input.aux_data(kIndPtr).FlatTo1D<xpu, IType>(), s);
+        Copy(output.aux_data(kIdx).FlatTo1D<xpu, IType>(s),
+             input.aux_data(kIdx).FlatTo1D<xpu, IType>(s), s);
+        Copy(output.aux_data(kIndPtr).FlatTo1D<xpu, IType>(s),
+             input.aux_data(kIndPtr).FlatTo1D<xpu, IType>(s), s);
       });
     });
   });
diff --git a/src/operator/mxnet_op.h b/src/operator/mxnet_op.h
index 30b3c85..c3f6dc6 100644
--- a/src/operator/mxnet_op.h
+++ b/src/operator/mxnet_op.h
@@ -322,7 +322,7 @@ MSHADOW_CINLINE void copy(mshadow::Stream<xpu> *s, const TBlob& to, const TBlob&
   CHECK_EQ(from.dev_mask(), to.dev_mask());
   MSHADOW_TYPE_SWITCH(to.type_flag_, DType, {
     if (to.type_flag_ == from.type_flag_) {
-      mshadow::Copy(to.FlatTo1D<xpu, DType>(), from.FlatTo1D<xpu, DType>(), s);
+      mshadow::Copy(to.FlatTo1D<xpu, DType>(s), from.FlatTo1D<xpu, DType>(s), s);
     } else {
       MSHADOW_TYPE_SWITCH(from.type_flag_, SrcDType, {
         to.FlatTo1D<xpu, DType>(s) = mshadow::expr::tcast<DType>(from.FlatTo1D<xpu, SrcDType>(s));

-- 
To stop receiving notification emails like this one, please contact
cjolivier01@apache.org.