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

Commit

Permalink
format fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Tommliu committed Nov 20, 2019
1 parent 9dbd79f commit d848823
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 17 deletions.
10 changes: 5 additions & 5 deletions python/mxnet/ndarray/numpy/_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -5420,20 +5420,20 @@ def where(condition, x=None, y=None):
return _npi.where(condition, x, y, out=None)


def unravel_index(indices, shape, order = 'C'):
def unravel_index(indices, shape, order='C'): # pylint: disable=redefined-outer-name
"""
Converts a flat index or array of flat indices into a tuple of coordinate arrays.
Parameters:
Parameters:
-------------
indices : array_like
An integer array whose elements are indices into the flattened version of an array of dimensions shape.
An integer array whose elements are indices into the flattened version of an array of dimensions shape.
Before version 1.6.0, this function accepted just one index value.
shape : tuple of ints
The shape of the array to use for unraveling indices.
Returns:
-------------
-------------
unraveled_coords : ndarray
Each row in the ndarray has the same shape as the indices array.
Each column in the ndarray represents the unravelled index
Expand All @@ -5453,4 +5453,4 @@ def unravel_index(indices, shape, order = 'C'):
ret_list += [item]
return tuple(ret_list)
else:
raise NotImplementedError('Operator unravel_index does not support column-major (Fortran-style) order at this moment')
raise NotImplementedError('Do not support column-major (Fortran-style) order at this moment')
10 changes: 5 additions & 5 deletions python/mxnet/numpy/multiarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -7404,21 +7404,21 @@ def where(condition, x=None, y=None):
return _mx_nd_np.where(condition, x, y)


def unravel_index(indices, shape, order = 'C'):
def unravel_index(indices, shape, order='C'): # pylint: disable=redefined-outer-name
"""
Converts a flat index or array of flat indices into a tuple of coordinate arrays.
Parameters:
Parameters:
-------------
indices : array_like
An integer array whose elements are indices into the flattened version of an array of dimensions shape.
An integer array whose elements are indices into the flattened version of an array of dimensions shape.
Before version 1.6.0, this function accepted just one index value.
shape : tuple of ints
The shape of the array to use for unraveling indices.
order : Only row-major is supported currently.
Returns:
-------------
-------------
unraveled_coords : ndarray
Each row in the ndarray has the same shape as the indices array.
Each column in the ndarray represents the unravelled index
Expand All @@ -7431,4 +7431,4 @@ def unravel_index(indices, shape, order = 'C'):
>>> np.unravel_index(1621, (6,7,8,9))
[3, 1, 4, 1]
"""
return _mx_nd_np.unravel_index(indices, shape, order = order)
return _mx_nd_np.unravel_index(indices, shape, order=order)
3 changes: 1 addition & 2 deletions python/mxnet/numpy_op_fallback.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
"""Fallback-to-NumPy operator implementation."""

from __future__ import absolute_import
from distutils.version import StrictVersion
import functools
import ast
import numpy as np
Expand Down Expand Up @@ -83,7 +82,7 @@ def create_operator(self, ctx, in_shapes, in_dtypes):
return Resize(self._new_shape)


@use_np
@use_np
class Unravel_index(operator.CustomOp):
"""Fallback to NumPy Unravel_index operator."""
def __init__(self, shape):
Expand Down
10 changes: 5 additions & 5 deletions python/mxnet/symbol/numpy/_symbol.py
Original file line number Diff line number Diff line change
Expand Up @@ -4934,20 +4934,20 @@ def where(condition, x, y):
return _npi.where(condition, x, y, out=None)


def unravel_index(indices, shape, order = 'C'):
def unravel_index(indices, shape, order='C'): # pylint: disable=redefined-outer-name
"""
Converts a flat index or array of flat indices into a tuple of coordinate arrays.
Parameters:
Parameters:
-------------
indices : array_like
An integer array whose elements are indices into the flattened version of an array of dimensions shape.
An integer array whose elements are indices into the flattened version of an array of dimensions shape.
Before version 1.6.0, this function accepted just one index value.
shape : tuple of ints
The shape of the array to use for unraveling indices.
Returns:
-------------
-------------
unraveled_coords : ndarray
Each row in the ndarray has the same shape as the indices array.
Each column in the ndarray represents the unravelled index
Expand All @@ -4963,7 +4963,7 @@ def unravel_index(indices, shape, order = 'C'):
if order == 'C':
return _npi.unravel_index_fallback(indices, shape=shape)
else:
raise NotImplementedError('Operator unravel_index does not support column-major (Fortran-style) order at this moment')
raise NotImplementedError('Don not support column-major (Fortran-style) order at this moment')


_set_np_symbol_class(_Symbol)

0 comments on commit d848823

Please sign in to comment.