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 2018/11/17 00:46:52 UTC

[GitHub] indhub closed pull request #13305: Made fixes to sparse.py and sparse.md

indhub closed pull request #13305: Made fixes to sparse.py and sparse.md
URL: https://github.com/apache/incubator-mxnet/pull/13305
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/docs/api/python/ndarray/sparse.md b/docs/api/python/ndarray/sparse.md
index acd5d2d4acc..608a9501a03 100644
--- a/docs/api/python/ndarray/sparse.md
+++ b/docs/api/python/ndarray/sparse.md
@@ -590,6 +590,7 @@ We summarize the interface for each class in the following sections.
     :exclude-members: BaseSparseNDArray, RowSparseNDArray, CSRNDArray
 
 .. automodule:: mxnet.ndarray.sparse
+    :noindex:
     :members: array, zeros, empty
 
 .. automodule:: mxnet.ndarray
diff --git a/python/mxnet/ndarray/sparse.py b/python/mxnet/ndarray/sparse.py
index 1e69eac7f70..928079749db 100644
--- a/python/mxnet/ndarray/sparse.py
+++ b/python/mxnet/ndarray/sparse.py
@@ -341,7 +341,7 @@ def __getitem__(self, key):
 
         Parameters
         ----------
-        key : int or slice
+        key : int or mxnet.ndarray.NDArray.slice
             Indexing key.
 
         Examples
@@ -389,7 +389,7 @@ def __setitem__(self, key, value):
 
         Parameters
         ----------
-        key : slice
+        key : mxnet.ndarray.NDArray.slice
             The indexing key.
         value : NDArray or CSRNDArray or numpy.ndarray
             The value to set.
@@ -626,7 +626,7 @@ def __getitem__(self, key):
 
         Parameters
         ----------
-        key : slice
+        key : mxnet.ndarray.NDArray.slice
             Indexing key.
 
         Examples
@@ -654,7 +654,7 @@ def __setitem__(self, key, value):
 
         Parameters
         ----------
-        key : slice
+        key : mxnet.ndarray.NDArray.slice
             The indexing key.
         value : NDArray or numpy.ndarray
             The value to set.
@@ -1025,28 +1025,28 @@ def row_sparse_array(arg1, shape=None, ctx=None, dtype=None):
 
     - row_sparse_array(D):
         to construct a RowSparseNDArray with a dense ndarray ``D``
-            -  **D** (*array_like*) - An object exposing the array interface, an object whose \
-            `__array__` method returns an array, or any (nested) sequence.
-            - **ctx** (*Context, optional*) - Device context \
-            (default is the current default context).
-            - **dtype** (*str or numpy.dtype, optional*) - The data type of the output array. \
-            The default dtype is ``D.dtype`` if ``D`` is an NDArray or numpy.ndarray, \
-            float32 otherwise.
+        -  **D** (*array_like*) - An object exposing the array interface, an object whose \
+        `__array__` method returns an array, or any (nested) sequence.
+        - **ctx** (*Context, optional*) - Device context \
+        (default is the current default context).
+        - **dtype** (*str or numpy.dtype, optional*) - The data type of the output array. \
+        The default dtype is ``D.dtype`` if ``D`` is an NDArray or numpy.ndarray, \
+        float32 otherwise.
 
     - row_sparse_array(S)
         to construct a RowSparseNDArray with a sparse ndarray ``S``
-            -  **S** (*RowSparseNDArray*) - A sparse ndarray.
-            - **ctx** (*Context, optional*) - Device context \
-            (default is the current default context).
-            - **dtype** (*str or numpy.dtype, optional*) - The data type of the output array. \
-            The default dtype is ``S.dtype``.
+        -  **S** (*RowSparseNDArray*) - A sparse ndarray.
+        - **ctx** (*Context, optional*) - Device context \
+        (default is the current default context).
+        - **dtype** (*str or numpy.dtype, optional*) - The data type of the output array. \
+        The default dtype is ``S.dtype``.
 
     - row_sparse_array((D0, D1 .. Dn))
         to construct an empty RowSparseNDArray with shape ``(D0, D1, ... Dn)``
-            -  **D0, D1 .. Dn** (*int*) - The shape of the ndarray
-            - **ctx** (*Context, optional*) - Device context \
-            (default is the current default context).
-            - **dtype** (*str or numpy.dtype, optional*) - The data type of the output array. \
+        -  **D0, D1 .. Dn** (*int*) - The shape of the ndarray
+        - **ctx** (*Context, optional*) - Device context \
+        (default is the current default context).
+        - **dtype** (*str or numpy.dtype, optional*) - The data type of the output array. \
             The default dtype is float32.
 
     - row_sparse_array((data, indices))
@@ -1057,35 +1057,35 @@ def row_sparse_array(arg1, shape=None, ctx=None, dtype=None):
         represented by RowSparseNDArray ``rsp`` has \
         ``dense[rsp.indices[i], :, :, :, ...] = rsp.data[i, :, :, :, ...]``
         The row indices for are expected to be **sorted in ascending order.** \
-            - **data** (*array_like*) - An object exposing the array interface, which \
-            holds all the non-zero row slices of the array.
-            - **indices** (*array_like*) - An object exposing the array interface, which \
-            stores the row index for each row slice with non-zero elements.
-            - **shape** (*tuple of int, optional*) - The shape of the array. The default \
-            shape is inferred from the indices and indptr arrays.
-            - **ctx** (*Context, optional*) - Device context \
-            (default is the current default context).
-            - **dtype** (*str or numpy.dtype, optional*) - The data type of the output array. \
-            The default dtype is float32.
+        - **data** (*array_like*) - An object exposing the array interface, which \
+        holds all the non-zero row slices of the array.
+        - **indices** (*array_like*) - An object exposing the array interface, which \
+        stores the row index for each row slice with non-zero elements.
+        - **shape** (*tuple of int, optional*) - The shape of the array. The default \
+        shape is inferred from the indices and indptr arrays.
+        - **ctx** (*Context, optional*) - Device context \
+        (default is the current default context).
+        - **dtype** (*str or numpy.dtype, optional*) - The data type of the output array. \
+        The default dtype is float32.
 
     Parameters
     ----------
-    arg1: NDArray, numpy.ndarray, RowSparseNDArray, tuple of int or tuple of array_like
+    arg1 : NDArray, numpy.ndarray, RowSparseNDArray, tuple of int or tuple of array_like
         The argument to help instantiate the row sparse ndarray. See above for further details.
     shape : tuple of int, optional
-        The shape of the row sparse ndarray.
+        The shape of the row sparse ndarray. (Default value = None)
     ctx : Context, optional
         Device context (default is the current default context).
     dtype : str or numpy.dtype, optional
-        The data type of the output array.
+        The data type of the output array. (Default value = None)
 
     Returns
     -------
     RowSparseNDArray
         An `RowSparseNDArray` with the `row_sparse` storage representation.
 
-    Example
-    -------
+    Examples
+    --------
     >>> a = mx.nd.sparse.row_sparse_array(([[1, 2], [3, 4]], [1, 4]), shape=(6, 2))
     >>> a.asnumpy()
     array([[ 0.,  0.],


 

----------------------------------------------------------------
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