You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2021/09/17 14:26:41 UTC

[GitHub] [incubator-mxnet] NathanYyc opened a new pull request #20592: Standardize MXNet NumPy Statistical & Linalg Functions

NathanYyc opened a new pull request #20592:
URL: https://github.com/apache/incubator-mxnet/pull/20592


   ## Description ##
   Part of [API standardization ](https://github.com/apache/incubator-mxnet/issues/20501)
   
   - add element-wise functions
   
     - add [asin](https://data-apis.org/array-api/latest/API_specification/elementwise_functions.html#asin-x), [asinh](https://data-apis.org/array-api/latest/API_specification/elementwise_functions.html#asinh-x), [acos](https://data-apis.org/array-api/latest/API_specification/elementwise_functions.html#acos-x), [acosh](https://data-apis.org/array-api/latest/API_specification/elementwise_functions.html#acosh-x), [atan](https://data-apis.org/array-api/latest/API_specification/elementwise_functions.html#atan-x), [atan2](https://data-apis.org/array-api/latest/API_specification/elementwise_functions.html#atan2-x1-x2), [atanh](https://data-apis.org/array-api/latest/API_specification/elementwise_functions.html#atanh-x), [bitwise_invert](https://data-apis.org/array-api/latest/API_specification/elementwise_functions.html#bitwise-invert-x), pow & \_ipow_
   
   - add manipulation functions
     - add [concat](https://data-apis.org/array-api/latest/API_specification/manipulation_functions.html#concat-arrays-axis-0)
   
   - change statistical functions
     - std: change keyword "ddof" to "correction"
     - var: change keyword "ddof" to "correction"
   
   - change linalg functions
     - add [vecdot](https://data-apis.org/array-api/latest/extensions/linear_algebra_functions.html#linalg-vecdot-x1-x2-axis-none)
     - eigvalsh: change keyword "UPLO" to "upper"
     - eigh: change keyword "UPLO" to "upper"
   
   ## Checklist ##
   ### Essentials ###
   - [ ] PR's title starts with a category (e.g. [BUGFIX], [MODEL], [TUTORIAL], [FEATURE], [DOC], etc)
   - [ ] Changes are complete (i.e. I finished coding on this PR)
   - [ ] All changes have test coverage
   - [ ] Code is well-documented
   
   ### Changes ###
   - [ ] Feature1, tests, (and when applicable, API doc)
   - [ ] Feature2, tests, (and when applicable, API doc)
   
   ## Comments ##
   - If this change is a backward incompatible change, why must this change be made.
   - Interesting edge cases to note here
   


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@mxnet.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] barry-jin commented on pull request #20592: [API Standardization]Standardize MXNet NumPy Statistical & Linalg Functions

Posted by GitBox <gi...@apache.org>.
barry-jin commented on pull request #20592:
URL: https://github.com/apache/incubator-mxnet/pull/20592#issuecomment-937369443


   @mxnet-bot run ci [centos-gpu]


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@mxnet.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] NathanYyc commented on pull request #20592: [API Standardization]Standardize MXNet NumPy Statistical & Linalg Functions

Posted by GitBox <gi...@apache.org>.
NathanYyc commented on pull request #20592:
URL: https://github.com/apache/incubator-mxnet/pull/20592#issuecomment-937480903


   @mxnet-bot run ci [centos-gpu]


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@mxnet.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] mxnet-bot commented on pull request #20592: [API Standardization]Standardize MXNet NumPy Statistical & Linalg Functions

Posted by GitBox <gi...@apache.org>.
mxnet-bot commented on pull request #20592:
URL: https://github.com/apache/incubator-mxnet/pull/20592#issuecomment-937369525


   Jenkins CI successfully triggered : [centos-gpu]


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@mxnet.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] barry-jin commented on pull request #20592: [API Standardization]Standardize MXNet NumPy Statistical & Linalg Functions

Posted by GitBox <gi...@apache.org>.
barry-jin commented on pull request #20592:
URL: https://github.com/apache/incubator-mxnet/pull/20592#issuecomment-937369443


   @mxnet-bot run ci [centos-gpu]


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@mxnet.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] barry-jin commented on a change in pull request #20592: [API Standardization]Standardize MXNet NumPy Statistical & Linalg Functions

Posted by GitBox <gi...@apache.org>.
barry-jin commented on a change in pull request #20592:
URL: https://github.com/apache/incubator-mxnet/pull/20592#discussion_r725336377



##########
File path: python/mxnet/numpy/multiarray.py
##########
@@ -8679,6 +9172,97 @@ def arctan2(x1, x2, out=None, **kwargs):
     """
     return _mx_nd_np.arctan2(x1, x2, out=out)
 
+atan2 = arctan2
+atan2.__doc__ = """
+    Element-wise arc tangent of ``x1/x2`` choosing the quadrant correctly.
+
+    The quadrant (i.e., branch) is chosen so that ``atan2(x1, x2)`` is
+    the signed angle in radians between the ray ending at the origin and
+    passing through the point (1,0), and the ray ending at the origin and
+    passing through the point (`x2`, `x1`).  (Note the role reversal: the
+    "`y`-coordinate" is the first function parameter, the "`x`-coordinate"
+    is the second.)  By IEEE convention, this function is defined for
+    `x2` = +/-0 and for either or both of `x1` and `x2` = +/-inf (see
+    Notes for specific values).
+
+    This function is not defined for complex-valued arguments; for the
+    so-called argument of complex values, use `angle`.
+    
+    >>>np.atan2 is np.arctan2
+    True
+
+    Parameters
+    ----------
+    x1 : ndarray or scalar
+        `y`-coordinates.
+    x2 : ndarray or scalar
+        `x`-coordinates. `x2` must be broadcastable to match the shape of
+        `x1` or vice versa.
+    out : ndarray or None, optional
+        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.
+
+    Returns
+    -------
+    out : ndarray or scalar
+        Array of angles in radians, in the range ``[-pi, pi]``. This is a scalar if
+        `x1` and `x2` are scalars.
+
+    .. notes::
+       `atan2` is a alias for `arctan2`. It is a standard API in
+       https://data-apis.org/array-api/latest/API_specification/elementwise_functions.html#atan2-x

Review comment:
       ```suggestion
          https://data-apis.org/array-api/latest/API_specification/elementwise_functions.html#atan2-x1-x2
   ```




-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@mxnet.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] barry-jin commented on a change in pull request #20592: [API Standardization]Standardize MXNet NumPy Statistical & Linalg Functions

Posted by GitBox <gi...@apache.org>.
barry-jin commented on a change in pull request #20592:
URL: https://github.com/apache/incubator-mxnet/pull/20592#discussion_r726645794



##########
File path: python/mxnet/numpy/linalg.py
##########
@@ -1273,7 +1331,7 @@ def eig(a):
     return _mx_nd_np.linalg.eig(a)
 
 
-def eigh(a, UPLO='L'):
+def eigh(a, upper=False):

Review comment:
       missing decorator @wrap_data_api_linalg_func

##########
File path: python/mxnet/numpy/linalg.py
##########
@@ -1148,7 +1202,7 @@ def eigvals(a):
     return _mx_nd_np.linalg.eigvals(a)
 
 
-def eigvalsh(a, UPLO='L'):
+def eigvalsh(a, upper=False):

Review comment:
       missing decorator @wrap_data_api_linalg_func




-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@mxnet.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] NathanYyc commented on pull request #20592: Standardize MXNet NumPy Statistical & Linalg Functions

Posted by GitBox <gi...@apache.org>.
NathanYyc commented on pull request #20592:
URL: https://github.com/apache/incubator-mxnet/pull/20592#issuecomment-921841124


   @barry-jin 


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@mxnet.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] barry-jin commented on a change in pull request #20592: Standardize MXNet NumPy Statistical & Linalg Functions

Posted by GitBox <gi...@apache.org>.
barry-jin commented on a change in pull request #20592:
URL: https://github.com/apache/incubator-mxnet/pull/20592#discussion_r720917943



##########
File path: python/mxnet/numpy/multiarray.py
##########
@@ -4168,11 +4248,10 @@ def expm1(x, out=None, **kwargs):
     """
     return _mx_nd_np.expm1(x, out=out, **kwargs)
 
-

Review comment:
       Do not remove/add any unnecessary new lines. 

##########
File path: python/mxnet/numpy/multiarray.py
##########
@@ -5183,6 +5469,58 @@ def arcsinh(x, out=None, **kwargs):
     """
     return _mx_nd_np.arcsinh(x, out=out, **kwargs)
 
+asinh = arcsinh
+asinh.__doc__ = """
+    Inverse hyperbolic cosine, element-wise.
+    
+    Notes
+    ----------
+    `asinh` is a alias for `arcsinh`. It is a standard API in
+    https://data-apis.org/array-api/latest/API_specification/elementwise_functions.html#asinh-x
+    instead of an official NumPy operator.
+    
+    >>>np.asinh is np.arcsinh
+    True
+
+    Parameters
+    ----------
+    x : ndarray or scalar
+        Input array.
+    out : ndarray or None, optional
+        A location into which the result is stored.
+
+    Returns
+    -------
+    asinh : ndarray
+        Array of the same shape as `x`.
+        This is a scalar if `x` is a scalar.
+
+    .. note::

Review comment:
       The same here. 

##########
File path: python/mxnet/numpy/multiarray.py
##########
@@ -3592,6 +3616,7 @@ def remainder(x1, x2, out=None, **kwargs):
     return _mx_nd_np.remainder(x1, x2, out=out)
 
 
+

Review comment:
       Do not remove/add any unnecessary new lines. 

##########
File path: python/mxnet/numpy/multiarray.py
##########
@@ -6533,6 +6972,56 @@ def dsplit(ary, indices_or_sections):
     """
     return _mx_nd_np.dsplit(ary, indices_or_sections)
 
+@set_module('mxnet.numpy')
+def concat(seq, axis=0, out=None):
+    """Join a sequence of arrays along an existing axis.
+
+    Parameters
+    ----------
+    a1, a2, ... : sequence of array_like
+        The arrays must have the same shape, except in the dimension
+        corresponding to `axis` (the first, by default).
+    axis : int, optional
+        The axis along which the arrays will be joined.  If axis is None,
+        arrays are flattened before use.  Default is 0.
+    out : ndarray, optional
+        If provided, the destination to place the result. The shape must be
+        correct, matching that of what concatenate would have returned if no
+        out argument were specified.
+
+    Returns
+    -------
+    res : ndarray
+        The concatenated array.
+
+    See Also
+    --------
+    split : Split array into a list of multiple sub-arrays of equal size.
+    hsplit : Split array into multiple sub-arrays horizontally (column wise)
+    vsplit : Split array into multiple sub-arrays vertically (row wise)
+    dsplit : Split array into multiple sub-arrays along the 3rd axis (depth).
+    stack : Stack a sequence of arrays along a new axis.
+    hstack : Stack arrays in sequence horizontally (column wise)
+    vstack : Stack arrays in sequence vertically (row wise)
+    dstack : Stack arrays in sequence depth wise (along third dimension)
+
+    Examples
+    --------
+    >>> a = np.array([[1, 2], [3, 4]])
+    >>> b = np.array([[5, 6]])
+    >>> np.concat((a, b), axis=0)
+    array([[1., 2.],
+           [3., 4.],
+           [5., 6.]])
+
+    >>> np.concat((a, b.T), axis=1)
+    array([[1., 2., 5.],
+           [3., 4., 6.]])
+

Review comment:
       Add note here to elaborate that concat is a standardized API and is equivelant to concatenate and also provide the reference. 

##########
File path: python/mxnet/numpy/multiarray.py
##########
@@ -4168,11 +4248,10 @@ def expm1(x, out=None, **kwargs):
     """
     return _mx_nd_np.expm1(x, out=out, **kwargs)
 
-
 @set_module('mxnet.numpy')
 @wrap_np_unary_func
 def arcsin(x, out=None, **kwargs):
-    r"""

Review comment:
       What should 'r' be removed here? 

##########
File path: python/mxnet/numpy/multiarray.py
##########
@@ -4264,6 +4405,49 @@ def arccos(x, out=None, **kwargs):
     """
     return _mx_nd_np.arccos(x, out=out, **kwargs)
 
+acos = arccos
+acos.__doc__ = """
+    Trigonometric inverse cosine, element-wise.
+    The inverse of cos so that, if y = cos(x), then x = acos(y).
+    
+    Notes
+    ----------
+    `acos` is a alias for `arccos`. It is a standard API in
+    https://data-apis.org/array-api/latest/API_specification/elementwise_functions.html#acos-x
+    instead of an official NumPy operator.
+    
+    >>>np.acos is np.arccos
+    True
+
+    Parameters
+    ----------
+    x : ndarray
+        x-coordinate on the unit circle. For real arguments, the domain is [-1, 1].
+    out : ndarray, optional
+        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.
+        A tuple (possible only as a keyword argument) must have length equal to the number of outputs.
+
+    Returns
+    ----------
+    angle : ndarray
+        The angle of the ray intersecting the unit circle at the given x-coordinate in radians [0, pi].
+        This is a scalar if x is a scalar.
+
+    Notes

Review comment:
       Could you append a note here to elaborate that acos is a standardized API and is equivelant to arccos and also provide the reference. 

##########
File path: python/mxnet/numpy/multiarray.py
##########
@@ -4309,6 +4493,56 @@ def arctan(x, out=None, **kwargs):
     """
     return _mx_nd_np.arctan(x, out=out, **kwargs)
 
+atan = arctan
+atan.__doc__ = """
+    Trigonometric inverse tangent, element-wise.
+    The inverse of tan, so that if ``y = tan(x)`` then ``x = atan(y)``.
+
+    Notes
+    ---------
+    `atan` is a alias for `arctan`. It is a standard API in
+    https://data-apis.org/array-api/latest/API_specification/elementwise_functions.html#atan-x
+    instead of an official NumPy operator.
+    
+    >>>np.atan is np.arctan
+    True
+    
+    Parameters
+    ----------
+    x : ndarray or scalar
+        Input values.
+    out : ndarray or None, optional
+        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.
+
+    Returns
+    -------
+    out : ndarray or scalar
+        Out has the same shape as `x`. It lies is in
+        ``[-pi/2, pi/2]`` (``atan(+/-inf)`` returns ``+/-pi/2``).
+        This is a scalar if `x` is a scalar.
+
+    Notes

Review comment:
       Could you append a note here to elaborate that atan is a standardized API and is equivelant to arctan and also provide the reference. 

##########
File path: python/mxnet/numpy/multiarray.py
##########
@@ -55,26 +55,25 @@
 from .fallback import *  # pylint: disable=wildcard-import,unused-wildcard-import
 from . import fallback
 
-

Review comment:
       Do not remove/add any unnecessary new lines. 

##########
File path: python/mxnet/numpy/multiarray.py
##########
@@ -8877,6 +9460,52 @@ def ldexp(x1, x2, out=None, **kwargs):
     """
     return _mx_nd_np.ldexp(x1, x2, out)
 
+@set_module('mxnet.numpy')
+def vecdot(a, b, axis=None):

Review comment:
       Move vecdot to mxnet.numpy.linalg namespace. 

##########
File path: python/mxnet/numpy/multiarray.py
##########
@@ -4225,6 +4304,68 @@ def arcsin(x, out=None, **kwargs):
     """
     return _mx_nd_np.arcsin(x, out=out, **kwargs)
 
+asin = arcsin
+asin.__doc__ = """
+    Inverse sine, element-wise.
+    
+    Notes
+    ----------
+    `asin` is a alias for `arcsin`. It is a standard API in
+    https://data-apis.org/array-api/latest/API_specification/elementwise_functions.html#asin-x
+    instead of an official NumPy operator.
+    
+    >>>np.asin is np.asin
+    True
+
+    Parameters
+    ----------
+    x : ndarray or scalar
+        `y`-coordinate on the unit circle.
+    out : ndarray or None, optional
+        A location into which the result is stored.
+        If provided, it must have the same shape as the input.
+        If not provided or None, a freshly-allocated array is returned.
+
+    Returns
+    -------
+    angle : ndarray or scalar
+        Output array is same shape and type as x. This is a scalar if x is a scalar.
+        The inverse sine of each element in `x`, in radians and in the
+        closed interval ``[-pi/2, pi/2]``.
+
+    Examples
+    --------
+    >>> np.asin(1)     # pi/2
+    1.5707963267948966
+    >>> np.asin(-1)    # -pi/2
+    -1.5707963267948966
+    >>> np.asin(0)
+    0.0
+
+    .. note::
+       `asin` is a multivalued function: for each `x` there are infinitely
+       many numbers `z` such that :math:`sin(z) = x`.  The convention is to
+       return the angle `z` whose real part lies in [-pi/2, pi/2].
+       For real-valued input data types, *asin* 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.
+       The inverse sine is also known as `asin` or sin^{-1}.
+       The output `ndarray` has the same `ctx` as the input `ndarray`.
+       This function differs from the original `numpy.arcsin
+       <https://docs.scipy.org/doc/numpy/reference/generated/numpy.arcsin.html>`_ in
+       the following aspects:
+
+       * Only support ndarray or scalar now.
+       * `where` argument is not supported.
+       * Complex input is not supported.

Review comment:
       Could you append a note here to elaborate that asin is a standardized API and is equivelant to arcsin and also provide the reference. 

##########
File path: python/mxnet/numpy/multiarray.py
##########
@@ -5277,6 +5665,57 @@ def arctanh(x, out=None, **kwargs):
     """
     return _mx_nd_np.arctanh(x, out=out, **kwargs)
 
+atanh = arctanh
+atanh.__doc__ = """
+    Inverse hyperbolic tangent, element-wise.
+
+    Notes
+    `atanh` is a alias for `arctanh`. It is a standard API in
+    https://data-apis.org/array-api/latest/API_specification/elementwise_functions.html#atanh-x
+    instead of an official NumPy operator.
+    
+    >>>np.atanh is np.arctanh
+    True
+
+    Parameters
+    ----------
+    x : ndarray or scalar
+        Input array.
+    out : ndarray or None, optional
+        A location into which the result is stored.
+
+    Returns
+    -------
+    atanh : ndarray
+        Array of the same shape as `x`.
+        This is a scalar if `x` is a scalar.
+
+    .. note::

Review comment:
       The same here. 

##########
File path: python/mxnet/numpy/multiarray.py
##########
@@ -5230,6 +5568,56 @@ def arccosh(x, out=None, **kwargs):
     """
     return _mx_nd_np.arccosh(x, out=out, **kwargs)
 
+acosh = arccosh
+acosh.__doc__ = """
+    Inverse hyperbolic cosine, element-wise.
+    
+    Notes
+    `acosh` is a alias for `arccosh`. It is a standard API in
+    https://data-apis.org/array-api/latest/API_specification/elementwise_functions.html#acosh-x
+    instead of an official NumPy operator.
+    
+    >>>np.acosh is np.arccosh
+    True
+
+    Parameters
+    ----------
+    x : ndarray or scalar
+        Input array.
+    out : ndarray or None, optional
+        A location into which the result is stored.
+
+    Returns
+    -------
+    acosh : ndarray
+        Array of the same shape as `x`.
+        This is a scalar if `x` is a scalar.
+
+    .. note::
+       `acosh` is a multivalued function: for each `x` there are infinitely

Review comment:
       The same here. 

##########
File path: python/mxnet/numpy/multiarray.py
##########
@@ -5866,7 +6305,7 @@ def trace(a, offset=0, axis1=0, axis2=1, out=None):
 
 
 @set_module('mxnet.numpy')
-def transpose(a, axes=None):
+def transpose(a: array, axes=None):

Review comment:
       Currently, we do not need to add type hint as some of the CI is still using Python < 3.8

##########
File path: python/mxnet/numpy/multiarray.py
##########
@@ -8877,6 +9460,52 @@ def ldexp(x1, x2, out=None, **kwargs):
     """
     return _mx_nd_np.ldexp(x1, x2, out)
 
+@set_module('mxnet.numpy')
+def vecdot(a, b, axis=None):
+    r"""
+        Return the dot product of two vectors.
+        Note that `vecdot` handles multidimensional arrays differently than `dot`:
+        it does *not* perform a matrix product, but flattens input arguments
+        to 1-D vectors first. Consequently, it should only be used for vectors.
+
+        Parameters
+        ----------
+        a : ndarray
+            First argument to the dot product.
+        b : ndarray
+            Second argument to the dot product.
+        axis : axis over which to compute the dot product. Must be an integer on
+            the interval [-N, N) , where N is the rank (number of dimensions) of
+            the shape determined according to Broadcasting . If specified as a
+            negative integer, the function must determine the axis along which
+            to compute the dot product by counting backward from the last dimension
+            (where -1 refers to the last dimension). If None , the function must
+            compute the dot product over the last axis. Default: None .
+
+        Returns
+        -------
+        output : ndarray
+            Dot product of `a` and `b`.
+
+        See Also
+        --------
+        dot : Return the dot product without using the complex conjugate of the
+            first argument.
+
+        Examples
+        --------
+        Note that higher-dimensional arrays are flattened!
+
+        >>> a = np.array([[1, 4], [5, 6]])
+        >>> b = np.array([[4, 1], [2, 2]])
+        >>> np.vecdot(a, b)
+        array(30.)
+        >>> np.vecdot(b, a)
+        array(30.)
+        >>> 1*4 + 4*1 + 5*2 + 6*2
+        30
+        """

Review comment:
       Indent using 4 spaces. 

##########
File path: python/mxnet/numpy/multiarray.py
##########
@@ -2016,13 +2040,13 @@ def mean(self, axis=None, dtype=None, out=None, keepdims=False):  # pylint: disa
         return mean(self, axis=axis, dtype=dtype, out=out, keepdims=keepdims)
 
     # pylint: disable=too-many-arguments, arguments-differ
-    def std(self, axis=None, dtype=None, out=None, ddof=0, keepdims=False):
+    def std(self, axis=None, dtype=None, out=None, correction=0, keepdims=False):
         """Returns the standard deviation of the array elements along given axis."""
-        return std(self, axis=axis, dtype=dtype, ddof=ddof, keepdims=keepdims, out=out)
+        return std(self, axis=axis, dtype=dtype, correction=correction, keepdims=keepdims, out=out)
 
-    def var(self, axis=None, dtype=None, out=None, ddof=0, keepdims=False):
+    def var(self, axis=None, dtype=None, out=None, correction=0, keepdims=False):

Review comment:
       Add decorator @wrap_data_api_statical_func here. 

##########
File path: python/mxnet/numpy/multiarray.py
##########
@@ -2016,13 +2040,13 @@ def mean(self, axis=None, dtype=None, out=None, keepdims=False):  # pylint: disa
         return mean(self, axis=axis, dtype=dtype, out=out, keepdims=keepdims)
 
     # pylint: disable=too-many-arguments, arguments-differ
-    def std(self, axis=None, dtype=None, out=None, ddof=0, keepdims=False):
+    def std(self, axis=None, dtype=None, out=None, correction=0, keepdims=False):

Review comment:
       Add decorator @wrap_data_api_statical_func here. 

##########
File path: python/mxnet/util.py
##########
@@ -645,6 +645,52 @@ def _wrap_np_binary_func(x1, x2, out=None, **kwargs):
         return func(x1, x2, out=out)
     return _wrap_np_binary_func
 
+def wrap_data_api_statical_func(func):
+    """A convenience decorator for wrapping data apis standardized statical functions to provide
+            context keyward backward compatibility
+            Parameters
+            ----------
+            func : a numpy-compatible array statical function to be wrapped for context keyward change.
+            Returns
+            -------
+            Function
+                A function wrapped with context keyward changes.
+            """

Review comment:
       Indent using 4 spaces. 

##########
File path: python/mxnet/util.py
##########
@@ -645,6 +645,52 @@ def _wrap_np_binary_func(x1, x2, out=None, **kwargs):
         return func(x1, x2, out=out)
     return _wrap_np_binary_func
 
+def wrap_data_api_statical_func(func):
+    """A convenience decorator for wrapping data apis standardized statical functions to provide
+            context keyward backward compatibility
+            Parameters
+            ----------
+            func : a numpy-compatible array statical function to be wrapped for context keyward change.
+            Returns
+            -------
+            Function
+                A function wrapped with context keyward changes.
+            """
+
+    @functools.wraps(func)
+    def _wrap_api_creation_func(*args, **kwargs):
+        if len(kwargs) != 0:
+            correction = kwargs.pop('ddof', None)
+            if correction is not None:
+                kwargs['correction'] = correction
+        return func(*args, **kwargs)
+
+    return _wrap_api_creation_func
+
+def wrap_data_api_linalg_func(func):
+    """A convenience decorator for wrapping data apis standardized linalg functions to provide
+        context keyward backward compatibility
+        Parameters

Review comment:
       Indent using 4 spaces. 




-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@mxnet.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] NathanYyc commented on pull request #20592: [API Standardization]Standardize MXNet NumPy Statistical & Linalg Functions

Posted by GitBox <gi...@apache.org>.
NathanYyc commented on pull request #20592:
URL: https://github.com/apache/incubator-mxnet/pull/20592#issuecomment-937480903


   @mxnet-bot run ci [centos-gpu]


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@mxnet.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] NathanYyc commented on pull request #20592: [API Standardization]Standardize MXNet NumPy Statistical & Linalg Functions

Posted by GitBox <gi...@apache.org>.
NathanYyc commented on pull request #20592:
URL: https://github.com/apache/incubator-mxnet/pull/20592#issuecomment-942134496


   @mxnet-bot run ci [centos-gpu]


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@mxnet.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] mxnet-bot commented on pull request #20592: Standardize MXNet NumPy Statistical & Linalg Functions

Posted by GitBox <gi...@apache.org>.
mxnet-bot commented on pull request #20592:
URL: https://github.com/apache/incubator-mxnet/pull/20592#issuecomment-921841024


   Hey @NathanYyc , Thanks for submitting the PR 
   All tests are already queued to run once. If tests fail, you can trigger one or more tests again with the following commands: 
   - To trigger all jobs: @mxnet-bot run ci [all] 
   - To trigger specific jobs: @mxnet-bot run ci [job1, job2] 
   *** 
   **CI supported jobs**: [windows-cpu, windows-gpu, unix-gpu, edge, clang, centos-cpu, centos-gpu, miscellaneous, sanity, website, unix-cpu]
   *** 
   _Note_: 
    Only following 3 categories can trigger CI :PR Author, MXNet Committer, Jenkins Admin. 
   All CI tests must pass before the PR can be merged. 
   


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@mxnet.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] barry-jin commented on a change in pull request #20592: Standardize MXNet NumPy Statistical & Linalg Functions

Posted by GitBox <gi...@apache.org>.
barry-jin commented on a change in pull request #20592:
URL: https://github.com/apache/incubator-mxnet/pull/20592#discussion_r711227876



##########
File path: python/mxnet/numpy/multiarray.py
##########
@@ -1163,6 +1163,11 @@ def __rpow__(self, other):
         """x.__rpow__(y) <=> y ** x"""
         return power(other, self)
 
+    @wrap_mxnp_np_ufunc
+    def __ipow__(self, other):
+        """x.__ipow__(y) <=> x *= y"""

Review comment:
       """x.\_\_ipow\_\_(y) <=> x **= y"""




-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@mxnet.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] mxnet-bot commented on pull request #20592: [API Standardization]Standardize MXNet NumPy Statistical & Linalg Functions

Posted by GitBox <gi...@apache.org>.
mxnet-bot commented on pull request #20592:
URL: https://github.com/apache/incubator-mxnet/pull/20592#issuecomment-937369525






-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@mxnet.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] mxnet-bot commented on pull request #20592: [API Standardization]Standardize MXNet NumPy Statistical & Linalg Functions

Posted by GitBox <gi...@apache.org>.
mxnet-bot commented on pull request #20592:
URL: https://github.com/apache/incubator-mxnet/pull/20592#issuecomment-937480961


   Jenkins CI successfully triggered : [centos-gpu]


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@mxnet.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] mxnet-bot commented on pull request #20592: [API Standardization]Standardize MXNet NumPy Statistical & Linalg Functions

Posted by GitBox <gi...@apache.org>.
mxnet-bot commented on pull request #20592:
URL: https://github.com/apache/incubator-mxnet/pull/20592#issuecomment-942134419






-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@mxnet.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] mxnet-bot commented on pull request #20592: [API Standardization]Standardize MXNet NumPy Statistical & Linalg Functions

Posted by GitBox <gi...@apache.org>.
mxnet-bot commented on pull request #20592:
URL: https://github.com/apache/incubator-mxnet/pull/20592#issuecomment-939800076


   Jenkins CI successfully triggered : [unix-cpu]


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@mxnet.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] NathanYyc commented on pull request #20592: [API Standardization]Standardize MXNet NumPy Statistical & Linalg Functions

Posted by GitBox <gi...@apache.org>.
NathanYyc commented on pull request #20592:
URL: https://github.com/apache/incubator-mxnet/pull/20592#issuecomment-942134329






-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@mxnet.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] mxnet-bot commented on pull request #20592: [API Standardization]Standardize MXNet NumPy Statistical & Linalg Functions

Posted by GitBox <gi...@apache.org>.
mxnet-bot commented on pull request #20592:
URL: https://github.com/apache/incubator-mxnet/pull/20592#issuecomment-942134419






-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@mxnet.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] barry-jin commented on a change in pull request #20592: Standardize MXNet NumPy Statistical & Linalg Functions

Posted by GitBox <gi...@apache.org>.
barry-jin commented on a change in pull request #20592:
URL: https://github.com/apache/incubator-mxnet/pull/20592#discussion_r711215778



##########
File path: python/mxnet/numpy/linalg.py
##########
@@ -890,9 +891,13 @@ def eigvalsh(a, UPLO='L'):
     >>> a = np.array([[ 5.4119368 ,  8.996273  , -5.086096  ],
     ...               [ 0.8866155 ,  1.7490431 , -4.6107802 ],
     ...               [-0.08034172,  4.4172044 ,  1.4528792 ]])
-    >>> LA.eigvalsh(a, UPLO='L')
+    >>> LA.eigvalsh(a, upper=False)
     array([-2.87381886,  5.10144682,  6.38623114]) # in ascending order
     """
+    if(upper==False):

Review comment:
       Comparison to `False` in python should be not expression: `if(upper==False)` => `if not upper`

##########
File path: python/mxnet/numpy/multiarray.py
##########
@@ -3591,6 +3589,55 @@ def remainder(x1, x2, out=None, **kwargs):
     """
     return _mx_nd_np.remainder(x1, x2, out=out)
 
+@set_module('mxnet.numpy')
+@wrap_np_binary_func
+def pow(x1, x2):

Review comment:
       We can use assignment to make `pow` the alias of `power` and add notes to inform the user that `pow` is not a official NumPy operator but a standard API. 
   
   Example:
   ```
   pow = power
   pow.__doc__ = ```
       ...
       Notes
       -----
       `pow` is an alias for `power`. It is a standard API in https://data-apis.org/array-api/latest/API_specification/elementwise_functions.html#pow-x1-x2 instead of an official NumPy operator. 
   
       >>> np.pow is np.power
       True
       ...
   ```
   
   We can apply this to other operators in this PR. What do you think. 

##########
File path: python/mxnet/numpy/multiarray.py
##########
@@ -3075,7 +3080,7 @@ def take(a, indices, axis=None, mode='raise', out=None):
 
 
 @set_module('mxnet.numpy')
-def unique(ar, return_index=False, return_inverse=False, return_counts=False, axis=None):
+def unique(ar, return_index=False, return_inverse=False, return_counts=False):

Review comment:
       Reserve axis keyword for backward compatibility. 

##########
File path: python/mxnet/numpy/linalg.py
##########
@@ -890,9 +891,13 @@ def eigvalsh(a, UPLO='L'):
     >>> a = np.array([[ 5.4119368 ,  8.996273  , -5.086096  ],
     ...               [ 0.8866155 ,  1.7490431 , -4.6107802 ],
     ...               [-0.08034172,  4.4172044 ,  1.4528792 ]])
-    >>> LA.eigvalsh(a, UPLO='L')
+    >>> LA.eigvalsh(a, upper=False)
     array([-2.87381886,  5.10144682,  6.38623114]) # in ascending order
     """
+    if(upper==False):
+        UPLO='L'
+    else:
+        UPLO='U'

Review comment:
       Lint check

##########
File path: python/mxnet/numpy/multiarray.py
##########
@@ -54,27 +54,27 @@
 from .utils import _get_np_op
 from .fallback import *  # pylint: disable=wildcard-import,unused-wildcard-import
 from . import fallback
-
+from ..util import wrap_data_api_statical_func

Review comment:
       import `wrap_data_api_statical_func` in line 48

##########
File path: python/mxnet/numpy/multiarray.py
##########
@@ -3591,6 +3589,55 @@ def remainder(x1, x2, out=None, **kwargs):
     """
     return _mx_nd_np.remainder(x1, x2, out=out)
 
+@set_module('mxnet.numpy')
+@wrap_np_binary_func
+def pow(x1, x2):
+    """
+        First array elements raised to powers from second array, element-wise.

Review comment:
       Remove the extra indentation in this docstring. 




-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@mxnet.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] barry-jin merged pull request #20592: [API Standardization]Standardize MXNet NumPy Statistical & Linalg Functions

Posted by GitBox <gi...@apache.org>.
barry-jin merged pull request #20592:
URL: https://github.com/apache/incubator-mxnet/pull/20592


   


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@mxnet.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] barry-jin commented on a change in pull request #20592: Standardize MXNet NumPy Statistical & Linalg Functions

Posted by GitBox <gi...@apache.org>.
barry-jin commented on a change in pull request #20592:
URL: https://github.com/apache/incubator-mxnet/pull/20592#discussion_r711227876



##########
File path: python/mxnet/numpy/multiarray.py
##########
@@ -1163,6 +1163,11 @@ def __rpow__(self, other):
         """x.__rpow__(y) <=> y ** x"""
         return power(other, self)
 
+    @wrap_mxnp_np_ufunc
+    def __ipow__(self, other):
+        """x.__ipow__(y) <=> x *= y"""

Review comment:
       """x.__ipow__(y) <=> x **= y"""




-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@mxnet.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] NathanYyc commented on pull request #20592: [API Standardization]Standardize MXNet NumPy Statistical & Linalg Functions

Posted by GitBox <gi...@apache.org>.
NathanYyc commented on pull request #20592:
URL: https://github.com/apache/incubator-mxnet/pull/20592#issuecomment-939800011


   @mxnet-bot run ci [unix-cpu]


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@mxnet.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org