Skip to content

Commit

Permalink
Fix docstring format (apache#8734)
Browse files Browse the repository at this point in the history
  • Loading branch information
reminisce authored and zhreshold committed Dec 14, 2017
1 parent 7c92b98 commit ae97b45
Showing 1 changed file with 22 additions and 10 deletions.
32 changes: 22 additions & 10 deletions python/mxnet/ndarray/ndarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,16 +376,25 @@ def __setstate__(self, state):
else:
self.handle = None

# pylint: disable=line-too-long
def __setitem__(self, key, value):
"""x.__setitem__(i, y) <=> x[i]=y
Set self[key] to value.
Sets value to self[key]. This functions supports advanced indexing defined in the following reference with
some restrictions.
https://docs.scipy.org/doc/numpy-1.13.0/reference/arrays.indexing.html#combining-advanced-and-basic-indexing
- If key is a list type, only a list of integers is supported, e.g. key=[1, 2] is supported,
while not for key=[[1, 2]].
- Ellipsis (...) and np.newaxis are not supported.
- Boolean array indexing is not supported.
Parameters
----------
key : int, slice or tuple
key : int, slice, list, np.ndarray, NDArray, or tuple of all previous types
The indexing key.
value : scalar, NDArray or numpy.ndarray
value : scalar or array-like object that can be broadcast to the shape of self[key]
The value to set.
Examples
Expand Down Expand Up @@ -431,24 +440,27 @@ def __setitem__(self, key, value):
else:
raise ValueError('Indexing NDArray with index=%s and type=%s is not supported'
% (str(key), str(type(key))))
# pylint: enable=line-too-long

# pylint: disable=line-too-long
def __getitem__(self, key):
"""x.__getitem__(i) <=> x[i]
Returns a sliced view of this array if the elements fetched are contiguous in memory;
otherwise, returns a newly created NDArray.
This functions supports advanced indexing defined in the following reference with
some limitations.
some restrictions.
https://docs.scipy.org/doc/numpy-1.13.0/reference/arrays.indexing.html#combining-advanced-and-basic-indexing
The following features/functionality are not supported for now:
1. If key is a list type, only a list of integers is supported,
i.e. key=[1, 2] is okay, while not for key=[[1]].
2. Ellipsis (...) and np.newaxis are not supported.
3. Boolean array indexing.
- If key is a list type, only a list of integers is supported, e.g. key=[1, 2] is supported,
while not for key=[[1, 2]].
- Ellipsis (...) and np.newaxis are not supported.
- Boolean array indexing is not supported.
Parameters
----------
key : int or slice, or array like
key : int, slice, list, np.ndarray, NDArray, or tuple of all previous types
Indexing key.
Examples
Expand Down

0 comments on commit ae97b45

Please sign in to comment.