[GitHub] [incubator-mxnet] gyshi commented on a change in pull request #15390: [Numpy fix-doc]modify numpy doc

2019-08-09 Thread GitBox
gyshi commented on a change in pull request #15390: [Numpy  fix-doc]modify 
numpy doc
URL: https://github.com/apache/incubator-mxnet/pull/15390#discussion_r312450999
 
 

 ##
 File path: python/mxnet/_numpy_op_doc.py
 ##
 @@ -22,37 +22,73 @@
 
 def _np_reshape(a, newshape, order='C'):
 """
-reshape(a, newshape, order='C')
-
 Gives a new shape to an array without changing its data.
 
 Parameters
 --
 a : ndarray
 Array to be reshaped.
-newshape : int or tuple of ints
+newshape : int, tuple of ints or list of ints
 The new shape should be compatible with the original shape. If
 an integer, then the result will be a 1-D array of that length.
 One shape dimension can be -1. In this case, the value is
 inferred from the length of the array and remaining dimensions.
-order : {'C'}, optional
+order : 'C', optional
 Read the elements of `a` using this index order, and place the
 elements into the reshaped array using this index order.  'C'
 means to read / write the elements using C-like index order,
 with the last axis index changing fastest, back to the first
-axis index changing slowest. Other order types such as 'F'/'A'
-may be added in the future.
+axis index changing slowest. We will add 'F'/'A' order types
 
 Review comment:
   done


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-mxnet] gyshi commented on a change in pull request #15390: [Numpy fix-doc]modify numpy doc

2019-07-02 Thread GitBox
gyshi commented on a change in pull request #15390: [Numpy  fix-doc]modify 
numpy doc
URL: https://github.com/apache/incubator-mxnet/pull/15390#discussion_r299376687
 
 

 ##
 File path: python/mxnet/symbol/numpy/_symbol.py
 ##
 @@ -1549,10 +1613,161 @@ def sqrt(x, out=None, **kwargs):
 square-root of each element in `x`. This is a scalar if `x` is a 
scalar.
 
 Notes
-
+-
 This function only supports input type of float.
 """
 return _unary_func_helper(x, _npi.sqrt, _np.sqrt, out=out, **kwargs)
 
 
+@set_module('mxnet.symbol.numpy')
+def ceil(x, out=None, **kwargs):
+r"""
+Return the ceiling of the input, element-wise.
+
+The ceil of the ndarray `x` is the smallest integer `i`, such that
+`i >= x`.  It is often denoted as :math:`\lceil x \rceil`.
+
+Parameters
+--
+x : _Symbol or scalar
+Input array.
+out : _Symbol or None
+A location into which the result is stored. If provided, it
+must have a shape that the inputs fill into. If not provided
+or None, a freshly-allocated array is returned. The dtype of the
+output and input must be the same.
+
+Returns
+---
+y :
+_Symbol or scalar
+The ceiling of each element in `x`, with `float` dtype.
+This is a scalar if `x` is a scalar.
+
+Examples
+
+>>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0])
+>>> np.ceil(a)
+array([-1., -1., -0.,  1.,  2.,  2.,  2.])
+
+>>> #if you use parameter out, x and out must be ndarray. if not, you will 
get an error!
+>>> a = np.array(1)
+>>> np.ceil(np.array(3.5), a)
+array(4.)
+>>> a
+array(4.)
+
+"""
+return _unary_func_helper(x, _npi.ceil, _np.ceil, out=out, **kwargs)
+
+
+@set_module('mxnet.symbol.numpy')
+def log1p(x, out=None, **kwargs):
+"""
+Return the natural logarithm of one plus the input array, element-wise.
+
+Calculates ``log(1 + x)``.
+
+Parameters
+--
+x : _Symbol or scalar
+Input array.
+out : _Symbol or None
+A location into which the result is stored. If provided, it
+must have a shape that the inputs fill into. If not provided
 
 Review comment:
   resolve


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-mxnet] gyshi commented on a change in pull request #15390: [Numpy fix-doc]modify numpy doc

2019-07-02 Thread GitBox
gyshi commented on a change in pull request #15390: [Numpy  fix-doc]modify 
numpy doc
URL: https://github.com/apache/incubator-mxnet/pull/15390#discussion_r299376638
 
 

 ##
 File path: python/mxnet/symbol/numpy/_symbol.py
 ##
 @@ -1549,10 +1613,161 @@ def sqrt(x, out=None, **kwargs):
 square-root of each element in `x`. This is a scalar if `x` is a 
scalar.
 
 Notes
-
+-
 This function only supports input type of float.
 """
 return _unary_func_helper(x, _npi.sqrt, _np.sqrt, out=out, **kwargs)
 
 
+@set_module('mxnet.symbol.numpy')
+def ceil(x, out=None, **kwargs):
+r"""
+Return the ceiling of the input, element-wise.
+
+The ceil of the ndarray `x` is the smallest integer `i`, such that
+`i >= x`.  It is often denoted as :math:`\lceil x \rceil`.
+
+Parameters
+--
+x : _Symbol or scalar
+Input array.
+out : _Symbol or None
+A location into which the result is stored. If provided, it
+must have a shape that the inputs fill into. If not provided
+or None, a freshly-allocated array is returned. The dtype of the
+output and input must be the same.
+
+Returns
+---
+y :
+_Symbol or scalar
+The ceiling of each element in `x`, with `float` dtype.
+This is a scalar if `x` is a scalar.
+
+Examples
+
+>>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0])
+>>> np.ceil(a)
+array([-1., -1., -0.,  1.,  2.,  2.,  2.])
+
+>>> #if you use parameter out, x and out must be ndarray. if not, you will 
get an error!
+>>> a = np.array(1)
+>>> np.ceil(np.array(3.5), a)
+array(4.)
+>>> a
+array(4.)
+
+"""
+return _unary_func_helper(x, _npi.ceil, _np.ceil, out=out, **kwargs)
+
+
+@set_module('mxnet.symbol.numpy')
+def log1p(x, out=None, **kwargs):
+"""
+Return the natural logarithm of one plus the input array, element-wise.
+
+Calculates ``log(1 + x)``.
+
+Parameters
+--
+x : _Symbol or scalar
+Input array.
+out : _Symbol or None
+A location into which the result is stored. If provided, it
+must have a shape that the inputs fill into. If not provided
+or None, a freshly-allocated array is returned. The dtype of the
+output and input must be the same.
+
+Returns
+---
+y : _Symbol or scalar
+Natural logarithm of 1 + x, element-wise. This is a scalar
+if x is a scalar.
+
+Notes
+-
+
+For real-valued input, `log1p` is accurate also for `x` so small
+that `1 + x == 1` in floating-point accuracy.
+
+Logarithm is a multivalued function: for each `x` there is an infinite
+number of `z` such that `exp(z) = 1 + x`. The convention is to return
+the `z` whose imaginary part lies in `[-pi, pi]`.
+
+For real-valued input data types, `log1p` always returns real output.
+For each value that cannot be expressed as a real number or infinity,
+it yields ``nan`` and sets the `invalid` floating point error flag.
+
+cannot support complex-valued input.
+
+Examples
+
+>>> np.log1p(1e-99)
+1e-99
+>>> a = np.array([3, 4, 5])
+>>> np.log1p(a)
+array([1.3862944, 1.609438 , 1.7917595])
+
+"""
+return _unary_func_helper(x, _npi.log1p, _np.log1p, out=out, **kwargs)
+
+
+@set_module('mxnet.symbol.numpy')
+def tanh(x, out=None, **kwargs):
+"""
+Compute hyperbolic tangent element-wise.
+
+Equivalent to ``np.sinh(x)/np.cosh(x)``.
+
+Parameters
+--
+x : _Symbol
+Input array.
+out : _Symbol or None
+A location into which the result is stored. If provided, it
+must have a shape that the inputs fill into. If not provided
+or None, a freshly-allocated array is returned. The dtype of the
+output and input must be the same.
 
 Review comment:
   resolve


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-mxnet] gyshi commented on a change in pull request #15390: [Numpy fix-doc]modify numpy doc

2019-07-01 Thread GitBox
gyshi commented on a change in pull request #15390: [Numpy  fix-doc]modify 
numpy doc
URL: https://github.com/apache/incubator-mxnet/pull/15390#discussion_r299303636
 
 

 ##
 File path: python/mxnet/numpy/multiarray.py
 ##
 @@ -1318,25 +1318,59 @@ def array(object, dtype=None, ctx=None):
 @set_module('mxnet.numpy')
 def zeros(shape, dtype=_np.float32, **kwargs):
 """Return a new array of given shape and type, filled with zeros.
-This function currently only supports storing multi-dimensional data
-in row-major (C-style).
 
 Parameters
 --
-shape : int or tuple of int
-The shape of the empty array.
-dtype : str or numpy.dtype, optional
-An optional value type (default is `numpy.float32`). Note that this
-behavior is different from NumPy's `ones` function where `float64`
-is the default value, because `float32` is considered as the default
-data type in deep learning.
+shape : int , tuple of ints or list of ints
+Shape of the new array, e.g., ``(2, 3)`` or ``2``.
+dtype : data-type, optional
+The desired data-type for the array, e.g., `numpy.int8`.  Default is
+`numpy.float32`.
 ctx : Context, optional
 An optional device context (default is the current default context).
 
 Returns
 ---
 out : ndarray
-Array of zeros with the given shape, dtype, and ctx.
+Array of zeros with the given shape, dtype, and order.
+
+Notes
+-
+- Not support ndarray type
+- Not support custom dtype
 
 Review comment:
   resolve


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-mxnet] gyshi commented on a change in pull request #15390: [Numpy fix-doc]modify numpy doc

2019-07-01 Thread GitBox
gyshi commented on a change in pull request #15390: [Numpy  fix-doc]modify 
numpy doc
URL: https://github.com/apache/incubator-mxnet/pull/15390#discussion_r299303603
 
 

 ##
 File path: python/mxnet/ndarray/numpy/_op.py
 ##
 @@ -680,7 +739,7 @@ def linspace(start, stop, num=50, endpoint=True, 
retstep=False, dtype=None, axis
 axis could only be 0 now.
 """
 if isinstance(start, (list, _np.ndarray, NDArray)) or \
-   isinstance(stop, (list, _np.ndarray, NDArray)):
+isinstance(stop, (list, _np.ndarray, NDArray)):
 
 Review comment:
   resolve


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-mxnet] gyshi commented on a change in pull request #15390: [Numpy fix-doc]modify numpy doc

2019-07-01 Thread GitBox
gyshi commented on a change in pull request #15390: [Numpy  fix-doc]modify 
numpy doc
URL: https://github.com/apache/incubator-mxnet/pull/15390#discussion_r299303363
 
 

 ##
 File path: python/mxnet/_numpy_op_doc.py
 ##
 @@ -173,3 +212,73 @@ def _np_cumsum(a, axis=None, dtype=None, out=None):
 `axis` is not None or `a` is a 1-d array.
 """
 pass
+
+
+def _np_max(axis=None, keepdims=False, initial=None, out=None):
+"""
+Return the maximum of an array or maximum along an axis.
+
+Parameters
+--
+a : ndarray
+Input data.
+axis : None or int or tuple of ints, optional
+Axis or axes along which to operate.  By default, flattened input is
+used.
+
+If this is a tuple of ints, the maximum is selected over multiple axes,
+instead of a single axis or all the axes as before.
+
+keepdims : bool, optional
+If this is set to True, the axes which are reduced are left
+in the result as dimensions with size one. With this option,
+the result will broadcast correctly against the input array.
+
+If the default value is passed, then `keepdims` will not be
+passed through to the `amax` method of sub-classes of
+`ndarray`, however any non-default value will be.  If the
+sub-class' method does not implement `keepdims` any
+exceptions will be raised.
+
+initial :
+Parameter initial is not supported yet, we will support it in the 
future.
+now it must be None.
+
+out : ndarray, optional
 
 Review comment:
   resolve,


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-mxnet] gyshi commented on a change in pull request #15390: [Numpy fix-doc]modify numpy doc

2019-07-01 Thread GitBox
gyshi commented on a change in pull request #15390: [Numpy  fix-doc]modify 
numpy doc
URL: https://github.com/apache/incubator-mxnet/pull/15390#discussion_r299303390
 
 

 ##
 File path: python/mxnet/ndarray/numpy/_op.py
 ##
 @@ -28,31 +28,65 @@
 __all__ = ['zeros', 'ones', 'maximum', 'minimum', 'stack', 'arange', 'argmax',
'add', 'subtract', 'multiply', 'divide', 'mod', 'power', 
'concatenate',
'clip', 'split', 'swapaxes', 'expand_dims', 'tile', 'linspace',
-   'sin', 'cos', 'sinh', 'cosh', 'log10', 'sqrt']
+   'sin', 'cos', 'sinh', 'cosh', 'log10', 'sqrt', 'ceil', 'log1p', 
'tanh']
 
 
 @set_module('mxnet.ndarray.numpy')
 def zeros(shape, dtype=_np.float32, **kwargs):
 """Return a new array of given shape and type, filled with zeros.
-This function currently only supports storing multi-dimensional data
-in row-major (C-style).
 
 Parameters
 --
-shape : int or tuple of int
-The shape of the empty array.
-dtype : str or numpy.dtype, optional
-An optional value type. Default is `numpy.float32`. Note that this
-behavior is different from NumPy's `ones` function where `float64`
-is the default value, because `float32` is considered as the default
-data type in deep learning.
+shape : int , tuple of ints or list of ints
+Shape of the new array, e.g., ``(2, 3)`` or ``2``.
+dtype : data-type, optional
+The desired data-type for the array, e.g., `numpy.int8`.  Default is
+`numpy.float32`.
 ctx : Context, optional
 An optional device context (default is the current default context).
 
 Returns
 ---
 out : ndarray
-Array of zeros with the given shape, dtype, and ctx.
+Array of zeros with the given shape, dtype, and order.
+
+Notes
+-
+- Not support ndarray type
+- Not support custom dtype
+
+>>> np.zeros((2,), dtype=[('x', 'i4'), ('y', 'i4')]) # custom dtype
+mxnet.base.MXNetError: Invalid Input.
+
+See Also
+
+zeros_like : Return an array of zeros with shape and type of input.
+ones : Return a new array setting values to one.
+
+Examples
+
+>>> np.zeros(5)
+array([0., 0., 0., 0., 0.])
+
+>>> np.zeros((5,), dtype=int)
+array([0, 0, 0, 0, 0])
+
+>>> np.zeros((2, 1))
+array([[0.],
+   [0.]])
+
+>>> s = (2,2)
+>>> np.zeros(s)
+array([[0., 0.],
+   [0., 0.]])
+
+if you install mxnet gpu version, you can use gpu.
 
 Review comment:
   resolve


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-mxnet] gyshi commented on a change in pull request #15390: [Numpy fix-doc]modify numpy doc

2019-07-01 Thread GitBox
gyshi commented on a change in pull request #15390: [Numpy  fix-doc]modify 
numpy doc
URL: https://github.com/apache/incubator-mxnet/pull/15390#discussion_r299303440
 
 

 ##
 File path: python/mxnet/symbol/numpy/_symbol.py
 ##
 @@ -1555,4 +1613,156 @@ def sqrt(x, out=None, **kwargs):
 return _unary_func_helper(x, _npi.sqrt, _np.sqrt, out=out, **kwargs)
 
 
+@set_module('mxnet.symbol.numpy')
+def ceil(x, out=None, **kwargs):
+r"""
+Return the ceiling of the input, element-wise.
+
+The ceil of the ndarray `x` is the smallest integer `i`, such that
+`i >= x`.  It is often denoted as :math:`\lceil x \rceil`.
+
+Parameters
+--
+x : _Symbol or scalar
+Input array.
+out : _Symbol or None
+A location into which the result is stored. If provided, it
+must have a shape that the inputs broadcast to. If not provided
+or None, a freshly-allocated array is returned. The dtype of the
+output is the same as that of the input if the input is an ndarray.
+
+Returns
+---
+y :
+_Symbol or scalar
+The ceiling of each element in `x`, with `float` dtype.
+This is a scalar if `x` is a scalar.
+
+Examples
+
+>>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0])
+>>> np.ceil(a)
+array([-1., -1., -0.,  1.,  2.,  2.,  2.])
+
+>>> #if you use parameter out, x and out must be ndarray. if not, you will 
get an error!
+>>> a = np.array(1)
+>>> np.ceil(np.array(3.5), a)
+array(4.)
+>>> a
+array(4.)
+
+"""
+return _unary_func_helper(x, _npi.ceil, _np.ceil, out=out, **kwargs)
+
+
+@set_module('mxnet.symbol.numpy')
+def log1p(x, out=None, **kwargs):
+"""
+Return the natural logarithm of one plus the input array, element-wise.
+
+Calculates ``log(1 + x)``.
+
+Parameters
+--
+x :
+_Symbol or scalar
+Input array.
+out : _Symbol or None
+A location into which the result is stored. If provided, it
+must have a shape that the inputs broadcast to. If not provided
+or None, a freshly-allocated array is returned. The dtype of the
+output is the same as that of the input if the input is an ndarray.
+
+Returns
+---
+y : _Symbol or scalar
+Natural logarithm of 1 + x, element-wise. This is a scalar
+if x is a scalar.
+
+Notes
+-
+
+For real-valued input, `log1p` is accurate also for `x` so small
+that `1 + x == 1` in floating-point accuracy.
+
+Logarithm is a multivalued function: for each `x` there is an infinite
+number of `z` such that `exp(z) = 1 + x`. The convention is to return
+the `z` whose imaginary part lies in `[-pi, pi]`.
+
+For real-valued input data types, `log1p` always returns real output.
+For each value that cannot be expressed as a real number or infinity,
+it yields ``nan`` and sets the `invalid` floating point error flag.
+
+For complex-valued input, `log1p` is a complex analytical function that
+has a branch cut `[-inf, -1]` and is continuous from above on it.
+`log1p` handles the floating-point negative zero as an infinitesimal
+negative number, conforming to the C99 standard.
+
+Examples
+
+>>> np.log1p(1e-99)
+1e-99
+
+"""
+return _unary_func_helper(x, _npi.log1p, _np.log1p, out=out, **kwargs)
+
+
+@set_module('mxnet.symbol.numpy')
+def tanh(x, out=None, **kwargs):
+"""
+Compute hyperbolic tangent element-wise.
+
+Equivalent to ``np.sinh(x)/np.cosh(x)``.
+
+Parameters
+--
+x :
+_Symbol
+Input array.
+out : _Symbol or None
+A location into which the result is stored. If provided, it
+must have a shape that the inputs broadcast to. If not provided
+or None, a freshly-allocated array is returned. The dtype of the
+output is the same as that of the input if the input is an ndarray.
+Returns
+---
+y : _Symbol
+The corresponding hyperbolic tangent values.
+
+Notes
+-
+If `out` is provided, the function writes the result into it,
+and returns a reference to `out`.  (See Examples)
+
+- Not support complex computation (like imaginary number)
+
+>>> np.tanh(np.pi*1j)
+TypeError: type  not supported
+
+Examples
+
+>>> np.tanh(np.array[0, np.pi]))
 
 Review comment:
   resolve


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-mxnet] gyshi commented on a change in pull request #15390: [Numpy fix-doc]modify numpy doc

2019-07-01 Thread GitBox
gyshi commented on a change in pull request #15390: [Numpy  fix-doc]modify 
numpy doc
URL: https://github.com/apache/incubator-mxnet/pull/15390#discussion_r299303483
 
 

 ##
 File path: python/mxnet/ndarray/numpy/_op.py
 ##
 @@ -864,7 +925,7 @@ def sqrt(x, out=None, **kwargs):
 
 Parameters
 --
-x : ndarray or scalar
+x : ndarray
 
 Review comment:
   resolve


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-mxnet] gyshi commented on a change in pull request #15390: [Numpy fix-doc]modify numpy doc

2019-07-01 Thread GitBox
gyshi commented on a change in pull request #15390: [Numpy  fix-doc]modify 
numpy doc
URL: https://github.com/apache/incubator-mxnet/pull/15390#discussion_r299303212
 
 

 ##
 File path: python/mxnet/_numpy_op_doc.py
 ##
 @@ -32,24 +33,70 @@ def _np_reshape(a, newshape, order='C'):
 an integer, then the result will be a 1-D array of that length.
 One shape dimension can be -1. In this case, the value is
 inferred from the length of the array and remaining dimensions.
-order : {'C'}, optional
+order : {'C', 'F', 'A'}, optional
 Read the elements of `a` using this index order, and place the
 elements into the reshaped array using this index order.  'C'
 means to read / write the elements using C-like index order,
 with the last axis index changing fastest, back to the first
-axis index changing slowest. Other order types such as 'F'/'A'
-may be added in the future.
+axis index changing slowest. 'F' means to read / write the
+elements using Fortran-like index order, with the first index
+changing fastest, and the last index changing slowest. Note that
+the 'C' and 'F' options take no account of the memory layout of
+the underlying array, and only refer to the order of indexing.
+'A' means to read / write the elements in Fortran-like index
+order if `a` is Fortran *contiguous* in memory, C-like order
+otherwise.
 
 Returns
 ---
 reshaped_array : ndarray
-It will be always a copy of the original array. This behavior is 
different
-from the official NumPy package where views of the original array may 
be
-generated.
+This will be a new view object if possible; otherwise, it will
+be a copy.  Note there is no guarantee of the *memory layout* (C- or
+Fortran- contiguous) of the returned array.
 
-See Also
+
+Notes
+-
+It is not always possible to change the shape of an array without
+copying the data. If you want an error to be raised when the data is 
copied,
+you should assign the new shape to the shape attribute of the array::
+
+ >>> a = np.zeros((10, 2))
+ # A transpose makes the array non-contiguous
+ >>> b = a.T
+ # Taking a view makes it possible to modify the shape without modifying
+ # the initial object.
+
+>>> a = np.arange(6).reshape((3, 2))
+>>> a
+array([[0., 1.],
+   [2., 3.],
+   [4., 5.]])
+
+You can think of reshaping as first raveling the array (using the given
+index order), then inserting the elements from the raveled array into the
+new array using the same kind of index ordering as was used for the
+raveling.
+
+>>> np.reshape(a, (2, 3)) # C-like index ordering
+array([[0., 1., 2.],
+   [3., 4., 5.]])
+
+- order only support C-order
+- input not support scalar
+- not support zero-size shape
+
+Examples
 
-ndarray.reshape : Equivalent method.
+>>> a = np.array([[1,2,3], [4,5,6]])
+>>> np.reshape(a, 6)
+array([1., 2., 3., 4., 5., 6.])
+
+>>> np.reshape(a, (3,-1))   # the unspecified value is inferred to be 2
 
 Review comment:
   resolve


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-mxnet] gyshi commented on a change in pull request #15390: [Numpy fix-doc]modify numpy doc

2019-07-01 Thread GitBox
gyshi commented on a change in pull request #15390: [Numpy  fix-doc]modify 
numpy doc
URL: https://github.com/apache/incubator-mxnet/pull/15390#discussion_r299303191
 
 

 ##
 File path: python/mxnet/_numpy_op_doc.py
 ##
 @@ -21,7 +21,8 @@
 
 
 def _np_reshape(a, newshape, order='C'):
 
 Review comment:
   resolve


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-mxnet] gyshi commented on a change in pull request #15390: [Numpy fix-doc]modify numpy doc

2019-07-01 Thread GitBox
gyshi commented on a change in pull request #15390: [Numpy  fix-doc]modify 
numpy doc
URL: https://github.com/apache/incubator-mxnet/pull/15390#discussion_r298939580
 
 

 ##
 File path: python/mxnet/ndarray/numpy/_op.py
 ##
 @@ -878,7 +937,160 @@ def sqrt(x, out=None, **kwargs):
 square-root of each element in `x`. This is a scalar if `x` is a 
scalar.
 
 Notes
-
+-
 This function only supports input type of float.
 """
 return _unary_func_helper(x, _npi.sqrt, _np.sqrt, out=out, **kwargs)
+
+
+@set_module('mxnet.ndarray.numpy')
+def ceil(x, out=None, **kwargs):
+r"""
+Return the ceiling of the input, element-wise.
+
+The ceil of the ndarray `x` is the smallest integer `i`, such that
+`i >= x`.  It is often denoted as :math:`\lceil x \rceil`.
+
+Parameters
+--
+x : ndarray or scalar
+Input array.
+out : ndarray or None
+A location into which the result is stored. If provided, it
+must have a same shape that the inputs fill into. If not provided
+or None, a freshly-allocated array is returned. The dtype of the
+output and input must be the same.
+
+Returns
+---
+y : ndarray or scalar
+The ceiling of each element in `x`, with `float` dtype.
+This is a scalar if `x` is a scalar.
+
+Examples
+
+>>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0])
+>>> np.ceil(a)
+array([-1., -1., -0.,  1.,  2.,  2.,  2.])
+
+>>> #if you use parameter out, x and out must be ndarray. if not, you will 
get an error!
+>>> a = np.array(1)
+>>> np.ceil(np.array(3.5), a)
+array(4.)
+>>> a
+array(4.)
+
+"""
+return _unary_func_helper(x, _npi.ceil, _np.ceil, out=out, **kwargs)
+
+
+@set_module('mxnet.ndarray.numpy')
+def log1p(x, out=None, **kwargs):
+"""
+Return the natural logarithm of one plus the input array, element-wise.
+
+Calculates ``log(1 + x)``.
+
+Parameters
+--
+x : ndarray or scalar
+Input array.
+out : ndarray or None
+A location into which the result is stored. If provided, it
+must have a shape that the inputs fill into. If not provided
+or None, a freshly-allocated array is returned. The dtype of the
+output and input must be the same.
+
+Returns
+---
+y : ndarray or scalar
+Natural logarithm of 1 + x, element-wise. This is a scalar
+if x is a scalar.
+
+Notes
+-
+
+For real-valued input, `log1p` is accurate also for `x` so small
+that `1 + x == 1` in floating-point accuracy.
+
+Logarithm is a multivalued function: for each `x` there is an infinite
+number of `z` such that `exp(z) = 1 + x`. The convention is to return
+the `z` whose imaginary part lies in `[-pi, pi]`.
+
+For real-valued input data types, `log1p` always returns real output.
+For each value that cannot be expressed as a real number or infinity,
+it yields ``nan`` and sets the `invalid` floating point error flag.
+
+For complex-valued input, `log1p` is a complex analytical function that
+has a branch cut `[-inf, -1]` and is continuous from above on it.
+`log1p` handles the floating-point negative zero as an infinitesimal
+negative number, conforming to the C99 standard.
+
+Examples
+
+>>> np.log1p(1e-99)
+1e-99
+>>> a = np.array([3, 4, 5])
+>>> np.log1p(a)
+array([1.3862944, 1.609438 , 1.7917595])
+
+"""
+return _unary_func_helper(x, _npi.log1p, _np.log1p, out=out, **kwargs)
+
+
+@set_module('mxnet.ndarray.numpy')
+def tanh(x, out=None, **kwargs):
+"""
+Compute hyperbolic tangent element-wise.
+
+Equivalent to ``np.sinh(x)/np.cosh(x)``.
+
+Parameters
+--
+x : ndarray or scalar.
+Input array.
+out : ndarray or None
+A location into which the result is stored. If provided, it
+must have a shape that the inputs fill into. If not provided
+or None, a freshly-allocated array is returned. The dtype of the
+output and input must be the same.
+
+Returns
+---
+y : ndarray or scalar
+   The corresponding hyperbolic tangent values.
+
+Notes
+-
+If `out` is provided, the function writes the result into it,
+and returns a reference to `out`.  (See Examples)
+
+- Not support complex computation (like imaginary number)
 
 Review comment:
   yes,  not support 


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-mxnet] gyshi commented on a change in pull request #15390: [Numpy fix-doc]modify numpy doc

2019-07-01 Thread GitBox
gyshi commented on a change in pull request #15390: [Numpy  fix-doc]modify 
numpy doc
URL: https://github.com/apache/incubator-mxnet/pull/15390#discussion_r298939424
 
 

 ##
 File path: python/mxnet/numpy/multiarray.py
 ##
 @@ -1318,25 +1318,59 @@ def array(object, dtype=None, ctx=None):
 @set_module('mxnet.numpy')
 def zeros(shape, dtype=_np.float32, **kwargs):
 """Return a new array of given shape and type, filled with zeros.
-This function currently only supports storing multi-dimensional data
-in row-major (C-style).
 
 Parameters
 --
-shape : int or tuple of int
-The shape of the empty array.
-dtype : str or numpy.dtype, optional
-An optional value type (default is `numpy.float32`). Note that this
-behavior is different from NumPy's `ones` function where `float64`
-is the default value, because `float32` is considered as the default
-data type in deep learning.
+shape : int , tuple of ints or list of ints
+Shape of the new array, e.g., ``(2, 3)`` or ``2``.
+dtype : data-type, optional
+The desired data-type for the array, e.g., `numpy.int8`.  Default is
+`numpy.float32`.
 ctx : Context, optional
 An optional device context (default is the current default context).
 
 Returns
 ---
 out : ndarray
-Array of zeros with the given shape, dtype, and ctx.
+Array of zeros with the given shape, dtype, and order.
+
+Notes
+-
+- Not support ndarray type
+- Not support custom dtype
 
 Review comment:
   if input is np.array((3,2)) , it will return error!


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-mxnet] gyshi commented on a change in pull request #15390: [Numpy fix-doc]modify numpy doc

2019-06-30 Thread GitBox
gyshi commented on a change in pull request #15390: [Numpy  fix-doc]modify 
numpy doc
URL: https://github.com/apache/incubator-mxnet/pull/15390#discussion_r298871151
 
 

 ##
 File path: python/mxnet/ndarray/numpy/_op.py
 ##
 @@ -864,7 +925,7 @@ def sqrt(x, out=None, **kwargs):
 
 Parameters
 --
-x : ndarray or scalar
+x : ndarray
 
 Review comment:
   it's no mine, i rebase from apache/numpy 


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-mxnet] gyshi commented on a change in pull request #15390: [Numpy fix-doc]modify numpy doc

2019-06-28 Thread GitBox
gyshi commented on a change in pull request #15390: [Numpy  fix-doc]modify 
numpy doc
URL: https://github.com/apache/incubator-mxnet/pull/15390#discussion_r298543064
 
 

 ##
 File path: python/mxnet/_numpy_op_doc.py
 ##
 @@ -173,3 +212,73 @@ def _np_cumsum(a, axis=None, dtype=None, out=None):
 `axis` is not None or `a` is a 1-d array.
 """
 pass
+
+
+def _np_max(axis=None, keepdims=False, initial=None, out=None):
+"""
+Return the maximum of an array or maximum along an axis.
+
+Parameters
+--
+a : ndarray
+Input data.
+axis : None or int or tuple of ints, optional
+Axis or axes along which to operate.  By default, flattened input is
+used.
+
+If this is a tuple of ints, the maximum is selected over multiple axes,
+instead of a single axis or all the axes as before.
+
+keepdims : bool, optional
+If this is set to True, the axes which are reduced are left
+in the result as dimensions with size one. With this option,
+the result will broadcast correctly against the input array.
+
+If the default value is passed, then `keepdims` will not be
+passed through to the `amax` method of sub-classes of
+`ndarray`, however any non-default value will be.  If the
+sub-class' method does not implement `keepdims` any
+exceptions will be raised.
+
+initial :
+Parameter initial is not supported yet, we will support it in the 
future.
+now it must be None.
+
+out : ndarray, optional
+Alternative output array in which to place the result.  Must
+be of the same shape and buffer length as the expected output.
+
+Returns
+---
+amax : ndarray or scalar
+Maximum of `a`. If `axis` is None, the result is a scalar value.
+If `axis` is given, the result is an array of dimension
+``a.ndim - 1``.
+
+See Also
+
+amax equivalent function
+
+Notes
+-
+- Not support axis < 0.
+
+Examples not work:
+>>> np.max(np.array([[-50], [10]]), axis= -1)
+i >= 0 && i < ndim(): axis = -1 must be in range [0, 2)
+
+Examples
+
+>>> a = np.arange(4).reshape((2,2))
+>>> a
+array([[0., 1.],
+  [2., 3.]])
+>>> np.amax(a)   # Maximum of the flattened array
 
 Review comment:
   they are the same function


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-mxnet] gyshi commented on a change in pull request #15390: [Numpy fix-doc]modify numpy doc

2019-06-28 Thread GitBox
gyshi commented on a change in pull request #15390: [Numpy  fix-doc]modify 
numpy doc
URL: https://github.com/apache/incubator-mxnet/pull/15390#discussion_r298479854
 
 

 ##
 File path: python/mxnet/_numpy_op_doc.py
 ##
 @@ -32,24 +33,70 @@ def _np_reshape(a, newshape, order='C'):
 an integer, then the result will be a 1-D array of that length.
 One shape dimension can be -1. In this case, the value is
 inferred from the length of the array and remaining dimensions.
-order : {'C'}, optional
+order : {'C', 'F', 'A'}, optional
 Read the elements of `a` using this index order, and place the
 elements into the reshaped array using this index order.  'C'
 means to read / write the elements using C-like index order,
 with the last axis index changing fastest, back to the first
-axis index changing slowest. Other order types such as 'F'/'A'
-may be added in the future.
+axis index changing slowest. 'F' means to read / write the
+elements using Fortran-like index order, with the first index
+changing fastest, and the last index changing slowest. Note that
+the 'C' and 'F' options take no account of the memory layout of
+the underlying array, and only refer to the order of indexing.
+'A' means to read / write the elements in Fortran-like index
+order if `a` is Fortran *contiguous* in memory, C-like order
+otherwise.
 
 Returns
 ---
 reshaped_array : ndarray
-It will be always a copy of the original array. This behavior is 
different
-from the official NumPy package where views of the original array may 
be
-generated.
+This will be a new view object if possible; otherwise, it will
+be a copy.  Note there is no guarantee of the *memory layout* (C- or
+Fortran- contiguous) of the returned array.
 
-See Also
+
+Notes
+-
+It is not always possible to change the shape of an array without
+copying the data. If you want an error to be raised when the data is 
copied,
+you should assign the new shape to the shape attribute of the array::
+
+ >>> a = np.zeros((10, 2))
+ # A transpose makes the array non-contiguous
+ >>> b = a.T
+ # Taking a view makes it possible to modify the shape without modifying
+ # the initial object.
+
+>>> a = np.arange(6).reshape((3, 2))
+>>> a
+array([[0., 1.],
+   [2., 3.],
 
 Review comment:
   done


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-mxnet] gyshi commented on a change in pull request #15390: [Numpy fix-doc]modify numpy doc

2019-06-27 Thread GitBox
gyshi commented on a change in pull request #15390: [Numpy  fix-doc]modify 
numpy doc
URL: https://github.com/apache/incubator-mxnet/pull/15390#discussion_r298430456
 
 

 ##
 File path: python/mxnet/_numpy_op_doc.py
 ##
 @@ -32,24 +33,70 @@ def _np_reshape(a, newshape, order='C'):
 an integer, then the result will be a 1-D array of that length.
 One shape dimension can be -1. In this case, the value is
 inferred from the length of the array and remaining dimensions.
-order : {'C'}, optional
+order : {'C', 'F', 'A'}, optional
 
 Review comment:
   in the notes ,i have  give a hint


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-mxnet] gyshi commented on a change in pull request #15390: [Numpy fix-doc]modify numpy doc

2019-06-27 Thread GitBox
gyshi commented on a change in pull request #15390: [Numpy  fix-doc]modify 
numpy doc
URL: https://github.com/apache/incubator-mxnet/pull/15390#discussion_r298430178
 
 

 ##
 File path: python/mxnet/_numpy_op_doc.py
 ##
 @@ -32,24 +33,70 @@ def _np_reshape(a, newshape, order='C'):
 an integer, then the result will be a 1-D array of that length.
 One shape dimension can be -1. In this case, the value is
 inferred from the length of the array and remaining dimensions.
-order : {'C'}, optional
+order : {'C', 'F', 'A'}, optional
 Read the elements of `a` using this index order, and place the
 elements into the reshaped array using this index order.  'C'
 means to read / write the elements using C-like index order,
 with the last axis index changing fastest, back to the first
-axis index changing slowest. Other order types such as 'F'/'A'
-may be added in the future.
+axis index changing slowest. 'F' means to read / write the
+elements using Fortran-like index order, with the first index
+changing fastest, and the last index changing slowest. Note that
+the 'C' and 'F' options take no account of the memory layout of
+the underlying array, and only refer to the order of indexing.
+'A' means to read / write the elements in Fortran-like index
+order if `a` is Fortran *contiguous* in memory, C-like order
+otherwise.
 
 Returns
 ---
 reshaped_array : ndarray
-It will be always a copy of the original array. This behavior is 
different
-from the official NumPy package where views of the original array may 
be
-generated.
+This will be a new view object if possible; otherwise, it will
+be a copy.  Note there is no guarantee of the *memory layout* (C- or
+Fortran- contiguous) of the returned array.
 
-See Also
+
+Notes
+-
+It is not always possible to change the shape of an array without
+copying the data. If you want an error to be raised when the data is 
copied,
+you should assign the new shape to the shape attribute of the array::
+
+ >>> a = np.zeros((10, 2))
+ # A transpose makes the array non-contiguous
+ >>> b = a.T
+ # Taking a view makes it possible to modify the shape without modifying
+ # the initial object.
+
+>>> a = np.arange(6).reshape((3, 2))
+>>> a
+array([[0., 1.],
+   [2., 3.],
+   [4., 5.]])
+
+You can think of reshaping as first raveling the array (using the given
+index order), then inserting the elements from the raveled array into the
+new array using the same kind of index ordering as was used for the
+raveling.
+
+>>> np.reshape(a, (2, 3)) # C-like index ordering
+array([[0., 1., 2.],
+   [3., 4., 5.]])
 
 Review comment:
   done


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services