You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2017/10/24 17:39:46 UTC

[GitHub] eric-haibin-lin commented on a change in pull request #8403: dtype default to source_array.dtype for sparse ndarrays

eric-haibin-lin commented on a change in pull request #8403: dtype default to source_array.dtype for sparse ndarrays
URL: https://github.com/apache/incubator-mxnet/pull/8403#discussion_r146637417
 
 

 ##########
 File path: python/mxnet/ndarray/sparse.py
 ##########
 @@ -727,6 +727,18 @@ def _prepare_src_array(source_array, dtype):
             raise TypeError('values must be array like object')
     return source_array
 
+def _prepare_default_dtype(src_array, dtype):
+    """Prepare the value of dtype if `dtype` is None. If `src_array` is an NDArray, numpy.ndarray
+    or scipy.sparse.csr.csr_matrix, return src_array.dtype. float32 is returned otherwise."""
+    if dtype is None:
+        if isinstance(src_array, (NDArray, np.ndarray)):
+            dtype = src_array.dtype
+        elif spsp and isinstance(src_array, spsp.csr.csr_matrix):
 
 Review comment:
   scipy is an optional dependency right now. If scipy is not there, spsp is None

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services