haojin2 commented on a change in pull request #15385: added doc for numpy
operators
URL: https://github.com/apache/incubator-mxnet/pull/15385#discussion_r298426733
##########
File path: python/mxnet/ndarray/numpy/_op.py
##########
@@ -882,3 +883,172 @@ def sqrt(x, out=None, **kwargs):
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 floor(x, out=None, **kwargs):
+ r"""
+ Return the floor of the input, element-wise.
+ The floor of the scalar `x` is the largest integer `i`, such that
+ `i <= x`. It is often denoted as :math:`\lfloor x \rfloor`.
+
+ Parameters
+ ----------
+ x : ndarray
+ Input data.
+
+ Does not support scalar.
+
+ out : ndarray, None, or tuple of exactly one 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 exactly one element.
+
+ where : array_like, optional
+ Values of True indicate to calculate the ufunc at that position, values
+ of False indicate to leave the value in the output alone.
+
+ Not supported yet.
+
+ Returns
+ -------
+ y : ndarray
+ The floor of each element in `x`.
+
+ Notes
+ -----
+ Some spreadsheet programs calculate the "floor-towards-zero", in other
+ words ``floor(-2.5) == -2``. MXNet instead uses the definition of
+ `floor` where `floor(-2.5) == -3`.
+
+ This function differs to the original `numpy.floor
+ <https://docs.scipy.org/doc/numpy/reference/generated/numpy.floor.html>`_
in
+ the following aspects:
+
+ - The default value type is `float32` instead of `float64` in numpy.
+ - `a` only supports ndarray.
+ - `a` doe snot support scalar.
+ - `where` has no effect.
+ - if a tuple is passed into `out`, it must have exactly one ndarray.
+
+ Examples
+ --------
+ >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0])
+ >>> np.floor(a)
+ array([-2., -2., -1., 0., 1., 1., 2.])
+ """
+ return _unary_func_helper(x, _npi.floor, _np.floor, out=out, **kwargs)
+
+
+@set_module('mxnet.ndarray.numpy')
+def expm1(x, out=None, **kwargs):
+ r"""
+ Calculate ``exp(x) - 1`` for all elements in the array.
+
+ Parameters
+ ----------
+ x : ndarray
+ Input values.
+
+ out : ndarray, None, or tuple of exactly one 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 exactly one element.
+
+ where : array_like, optional
+
+ Values of True indicate to calculate the ufunc at that position, values
+ of False indicate to leave the value in the output alone.
+
+ Not supported yet.
+
+ Returns
+ -------
+ out : ndarray
+ Element-wise exponential minus one: ``out = exp(x) - 1``.
+
+ Notes
+ -----
+ This function provides greater precision than ``exp(x) - 1``
+ for small values of ``x``.
+
+ This function differs to the original `numpy.expm1
+ <https://docs.scipy.org/doc/numpy/reference/generated/numpy.expm1.html>`_
in
+ the following aspects:
+
+ - The default value type is `float32` instead of `float64` in numpy.
+ - `a` only supports ndarray.
+ - `a` doe snot support scalar.
+ - `where` has no effect.
+ - if a tuple is passed into `out`, it must have exactly one ndarray.
+
+ Examples
+ --------
+ >>> np.expm1(1e-10)
+ 1.00000000005e-10
+ """
+ return _unary_func_helper(x, _npi.expm1, _np.expm1, out=out, **kwargs)
+
+
+@set_module('mxnet.ndarray.numpy')
+def arcsinh(x, out=None, **kwargs):
+ r"""
+ Inverse hyperbolic sine element-wise.
+
+ Parameters
+ ----------
+ x : ndarray
+ Input array.
+
+ out : ndarray, None, or tuple of exactly one 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 exactly one element.
+
+ where : array_like, optional
Review comment:
you can override the signature, and do not expose an argument if it's
totally not supported. Same comment for all other similar ops.
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services