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 2019/07/01 02:58:41 UTC

[GitHub] [incubator-mxnet] mikemwx commented on a change in pull request #15388: Doc

mikemwx commented on a change in pull request #15388: Doc
URL: https://github.com/apache/incubator-mxnet/pull/15388#discussion_r298868671
 
 

 ##########
 File path: python/mxnet/ndarray/numpy/_op.py
 ##########
 @@ -720,6 +742,137 @@ def _unary_func_helper(x, fn_array, fn_scalar, out=None, **kwargs):
     else:
         raise TypeError('type {} not supported'.format(str(type(x))))
 
+@set_module('mxnet.ndarray.numpy')
+def trunc(x, out=None, **kwargs):
+    r"""
+    trunc(x, out=None)
+
+    Return the truncated value of the input, element-wise.
+
+    The truncated value of the scalar `x` is the nearest integer `i` which
+    is closer to zero than `x` is. In short, the fractional part of the
+    signed number `x` is discarded.
+    
+    Parameters
+    ----------
+    x : ndarray or scalar
+        Input data.
+    out : ndarray or None, optional 
+        A location into which the result is stored. 
+    
+    Returns
+    -------
+    y : ndarray or scalar
+        The truncated value of each element in `x`.
+        This is a scalar if `x` is a scalar.
+
+    Notes
+    -----
+    This function differs to the original numpy.trunc in the following aspects:
+        - Do not support where.
+        - Can't cast type automatically.
+        - Input can't broadcast to out.
+        - If x is plain python numeric, the result won't be stored in out.
+    
+    Examples
+    --------
+    >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0])
+    >>> np.trunc(a)
+    array([-1., -1., -0.,  0.,  1.,  1.,  2.])
+    """
+    return _unary_func_helper(x, _npi.trunc, _np.trunc, out=out, **kwargs)
+
+@set_module('mxnet.ndarray.numpy')
+def logical_not(x, out=None, **kwargs):
+    r"""
+    logical_not(x, out=None)
+
+    Compute the truth value of NOT x element-wise.
+
+    Parameters
+    ----------
+    x : ndarray or scalar
+        Logical NOT is applied to the elements of `x`.
+    out : ndarray or None, optional
+        A location into which the result is stored. 
+    
+    Returns
+    -------
+    y : bool or ndarray of bool
+        Boolean result with the same shape as `x` of the NOT operation
+        on elements of `x`.
+        This is a scalar if `x` is a scalar.
+
+    Notes
+    -----
+    This function differs to the original numpy.logical_not in the following aspects:
 
 Review comment:
   Also, differ from

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services