Skip to content
This repository was archived by the owner on Nov 17, 2023. It is now read-only.

Commit 1aa6a38

Browse files
vrakeshindhub
authored andcommitted
Made fixes to sparse.py and sparse.md (#13305)
1 parent 46e870b commit 1aa6a38

File tree

2 files changed

+36
-35
lines changed

2 files changed

+36
-35
lines changed

docs/api/python/ndarray/sparse.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -590,6 +590,7 @@ We summarize the interface for each class in the following sections.
590590
:exclude-members: BaseSparseNDArray, RowSparseNDArray, CSRNDArray
591591
592592
.. automodule:: mxnet.ndarray.sparse
593+
:noindex:
593594
:members: array, zeros, empty
594595
595596
.. automodule:: mxnet.ndarray

python/mxnet/ndarray/sparse.py

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ def __getitem__(self, key):
341341
342342
Parameters
343343
----------
344-
key : int or slice
344+
key : int or mxnet.ndarray.NDArray.slice
345345
Indexing key.
346346
347347
Examples
@@ -389,7 +389,7 @@ def __setitem__(self, key, value):
389389
390390
Parameters
391391
----------
392-
key : slice
392+
key : mxnet.ndarray.NDArray.slice
393393
The indexing key.
394394
value : NDArray or CSRNDArray or numpy.ndarray
395395
The value to set.
@@ -626,7 +626,7 @@ def __getitem__(self, key):
626626
627627
Parameters
628628
----------
629-
key : slice
629+
key : mxnet.ndarray.NDArray.slice
630630
Indexing key.
631631
632632
Examples
@@ -654,7 +654,7 @@ def __setitem__(self, key, value):
654654
655655
Parameters
656656
----------
657-
key : slice
657+
key : mxnet.ndarray.NDArray.slice
658658
The indexing key.
659659
value : NDArray or numpy.ndarray
660660
The value to set.
@@ -1025,28 +1025,28 @@ def row_sparse_array(arg1, shape=None, ctx=None, dtype=None):
10251025
10261026
- row_sparse_array(D):
10271027
to construct a RowSparseNDArray with a dense ndarray ``D``
1028-
- **D** (*array_like*) - An object exposing the array interface, an object whose \
1029-
`__array__` method returns an array, or any (nested) sequence.
1030-
- **ctx** (*Context, optional*) - Device context \
1031-
(default is the current default context).
1032-
- **dtype** (*str or numpy.dtype, optional*) - The data type of the output array. \
1033-
The default dtype is ``D.dtype`` if ``D`` is an NDArray or numpy.ndarray, \
1034-
float32 otherwise.
1028+
- **D** (*array_like*) - An object exposing the array interface, an object whose \
1029+
`__array__` method returns an array, or any (nested) sequence.
1030+
- **ctx** (*Context, optional*) - Device context \
1031+
(default is the current default context).
1032+
- **dtype** (*str or numpy.dtype, optional*) - The data type of the output array. \
1033+
The default dtype is ``D.dtype`` if ``D`` is an NDArray or numpy.ndarray, \
1034+
float32 otherwise.
10351035
10361036
- row_sparse_array(S)
10371037
to construct a RowSparseNDArray with a sparse ndarray ``S``
1038-
- **S** (*RowSparseNDArray*) - A sparse ndarray.
1039-
- **ctx** (*Context, optional*) - Device context \
1040-
(default is the current default context).
1041-
- **dtype** (*str or numpy.dtype, optional*) - The data type of the output array. \
1042-
The default dtype is ``S.dtype``.
1038+
- **S** (*RowSparseNDArray*) - A sparse ndarray.
1039+
- **ctx** (*Context, optional*) - Device context \
1040+
(default is the current default context).
1041+
- **dtype** (*str or numpy.dtype, optional*) - The data type of the output array. \
1042+
The default dtype is ``S.dtype``.
10431043
10441044
- row_sparse_array((D0, D1 .. Dn))
10451045
to construct an empty RowSparseNDArray with shape ``(D0, D1, ... Dn)``
1046-
- **D0, D1 .. Dn** (*int*) - The shape of the ndarray
1047-
- **ctx** (*Context, optional*) - Device context \
1048-
(default is the current default context).
1049-
- **dtype** (*str or numpy.dtype, optional*) - The data type of the output array. \
1046+
- **D0, D1 .. Dn** (*int*) - The shape of the ndarray
1047+
- **ctx** (*Context, optional*) - Device context \
1048+
(default is the current default context).
1049+
- **dtype** (*str or numpy.dtype, optional*) - The data type of the output array. \
10501050
The default dtype is float32.
10511051
10521052
- row_sparse_array((data, indices))
@@ -1057,35 +1057,35 @@ def row_sparse_array(arg1, shape=None, ctx=None, dtype=None):
10571057
represented by RowSparseNDArray ``rsp`` has \
10581058
``dense[rsp.indices[i], :, :, :, ...] = rsp.data[i, :, :, :, ...]``
10591059
The row indices for are expected to be **sorted in ascending order.** \
1060-
- **data** (*array_like*) - An object exposing the array interface, which \
1061-
holds all the non-zero row slices of the array.
1062-
- **indices** (*array_like*) - An object exposing the array interface, which \
1063-
stores the row index for each row slice with non-zero elements.
1064-
- **shape** (*tuple of int, optional*) - The shape of the array. The default \
1065-
shape is inferred from the indices and indptr arrays.
1066-
- **ctx** (*Context, optional*) - Device context \
1067-
(default is the current default context).
1068-
- **dtype** (*str or numpy.dtype, optional*) - The data type of the output array. \
1069-
The default dtype is float32.
1060+
- **data** (*array_like*) - An object exposing the array interface, which \
1061+
holds all the non-zero row slices of the array.
1062+
- **indices** (*array_like*) - An object exposing the array interface, which \
1063+
stores the row index for each row slice with non-zero elements.
1064+
- **shape** (*tuple of int, optional*) - The shape of the array. The default \
1065+
shape is inferred from the indices and indptr arrays.
1066+
- **ctx** (*Context, optional*) - Device context \
1067+
(default is the current default context).
1068+
- **dtype** (*str or numpy.dtype, optional*) - The data type of the output array. \
1069+
The default dtype is float32.
10701070
10711071
Parameters
10721072
----------
1073-
arg1: NDArray, numpy.ndarray, RowSparseNDArray, tuple of int or tuple of array_like
1073+
arg1 : NDArray, numpy.ndarray, RowSparseNDArray, tuple of int or tuple of array_like
10741074
The argument to help instantiate the row sparse ndarray. See above for further details.
10751075
shape : tuple of int, optional
1076-
The shape of the row sparse ndarray.
1076+
The shape of the row sparse ndarray. (Default value = None)
10771077
ctx : Context, optional
10781078
Device context (default is the current default context).
10791079
dtype : str or numpy.dtype, optional
1080-
The data type of the output array.
1080+
The data type of the output array. (Default value = None)
10811081
10821082
Returns
10831083
-------
10841084
RowSparseNDArray
10851085
An `RowSparseNDArray` with the `row_sparse` storage representation.
10861086
1087-
Example
1088-
-------
1087+
Examples
1088+
--------
10891089
>>> a = mx.nd.sparse.row_sparse_array(([[1, 2], [3, 4]], [1, 4]), shape=(6, 2))
10901090
>>> a.asnumpy()
10911091
array([[ 0., 0.],

0 commit comments

Comments
 (0)