Skip to content

Commit

Permalink
update ndarray.nd, remove invoke from excluded members
Browse files Browse the repository at this point in the history
remove __weakref__ from SparseNDArray

add data indice to doc

revert dlpack update

revert mxdoc changes

move methods from BaseSparseNDarray to csrndarray and rwosparse ndarray
  • Loading branch information
eric-haibin-lin committed Aug 5, 2017
1 parent d511938 commit 5aa6bcf
Show file tree
Hide file tree
Showing 4 changed files with 359 additions and 136 deletions.
65 changes: 63 additions & 2 deletions docs/api/python/ndarray.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,21 @@ A detailed tutorial is available at
```

In the rest of this document, we first overview the methods provided by the
`ndarray.NDArray` class, and then list other routines provided by the
`ndarray` package.
`ndarray.NDArray` class and its subclasses, and then list other routines
provided by the `ndarray` package.

The `ndarray` package provides several classes:

```eval_rst
.. autosummary::
:nosignatures:
NDArray
CSRNDArray
RowSparseNDArray
```

We summarize the interface for each class in the following sections.

## The `NDArray` class

Expand All @@ -80,6 +92,7 @@ In the rest of this document, we first overview the methods provided by the
NDArray.size
NDArray.context
NDArray.dtype
NDArray.stype
```

### Array conversion
Expand Down Expand Up @@ -171,6 +184,33 @@ In the rest of this document, we first overview the methods provided by the
NDArray.wait_to_read
```

## The `RowSparseNDArray` Class

```eval_rst
.. autosummary::
:nosignatures:
RowSparseNDArray.copyto
RowSparseNDArray.__setitem__
RowSparseNDArray.__getitem__
RowSparseNDArray.data
RowSparseNDArray.indices
```

## The `CSRNDArray` Class

```eval_rst
.. autosummary::
:nosignatures:
CSRNDArray.copyto
CSRNDArray.__setitem__
CSRNDArray.__getitem__
CSRNDArray.data
CSRNDArray.indices
CSRNDArray.indptr
```

## Array creation routines

```eval_rst
Expand Down Expand Up @@ -499,8 +539,29 @@ The `contrib.ndarray` module contains many useful experimental APIs for new feat
<script type="text/javascript" src='../../_static/js/auto_module_index.js'></script>

```eval_rst
.. autoclass:: mxnet.ndarray.NDArray
:members:
:special-members:
.. autoclass:: mxnet.ndarray.BaseSparseNDArray
:members:
:special-members:
:exclude-members: __weakref__
.. autoclass:: mxnet.ndarray.CSRNDArray
:members:
:special-members:
.. autoclass:: mxnet.ndarray.RowSparseNDArray
:members:
:special-members:
.. automodule:: mxnet.ndarray
:members:
:imported-members:
:special-members:
:exclude-members: CachedOp, BaseSparseNDArray, NDArray, CSRNDArray, RowSparseNDArray
.. automodule:: mxnet.random
:members:
Expand Down
12 changes: 5 additions & 7 deletions python/mxnet/ndarray/__init__.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
"""ndarray module"""
"""NDArray API of MXNet."""

from . import _internal
from . import op
from .op import CachedOp
from .ndarray import NDArray, concatenate, _DTYPE_NP_TO_MX, _DTYPE_MX_TO_NP
from .ndarray import ones, add, arange, divide, equal, full, greater, greater_equal, imdecode
from .ndarray import lesser, lesser_equal, maximum, minimum, moveaxis, multiply, negative, not_equal
from .ndarray import onehot_encode, power, subtract, true_divide, waitall, _new_empty_handle
# pylint: disable=wildcard-import
from .ndarray import *
from .ndarray_utils import load, save, zeros, empty, array
from .sparse_ndarray import _ndarray_cls, todense
from .sparse_ndarray import csr, row_sparse, BaseSparseNDArray, RowSparseNDArray, CSRNDArray
from .sparse_ndarray import _ndarray_cls
from .sparse_ndarray import csr, row_sparse, BaseSparseNDArray, todense, RowSparseNDArray, CSRNDArray
8 changes: 8 additions & 0 deletions python/mxnet/ndarray/ndarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@
from . import broadcast_greater, broadcast_greater_equal, broadcast_lesser, broadcast_lesser_equal
from . import zeros_like, slice

__all__ = ["NDArray", "concatenate", "_DTYPE_NP_TO_MX", "_DTYPE_MX_TO_NP", \
"ones", "add", "arange", "divide", "equal", "full", "greater", "greater_equal", \
"imdecode", "lesser", "lesser_equal", "maximum", "minimum", "moveaxis", \
"multiply", "negative", "not_equal", "onehot_encode", "power", "subtract", \
"true_divide", "waitall", "_new_empty_handle"]

# pylint: disable= no-member
_DTYPE_NP_TO_MX = {
None : -1,
Expand Down Expand Up @@ -819,6 +825,8 @@ def dtype(self):

@property
def stype(self):
"""Storage-type of the array.
"""
return _storage_type(self.handle)

@property
Expand Down
Loading

0 comments on commit 5aa6bcf

Please sign in to comment.