tingying2020 commented on a change in pull request #16016: [numpy] operator 
ravel, derive from reshape
URL: https://github.com/apache/incubator-mxnet/pull/16016#discussion_r323689966
 
 

 ##########
 File path: python/mxnet/symbol/numpy/_symbol.py
 ##########
 @@ -2678,4 +2678,42 @@ def var(a, axis=None, dtype=None, out=None, ddof=0, 
keepdims=False):  # pylint:
     return _npi.var(a, axis=axis, dtype=dtype, ddof=ddof, keepdims=keepdims, 
out=out)
 
 
+@set_module('mxnet.symbol.numpy')
+def ravel(x, out=None):
+    r"""
+    ravel(x, out=None)
+
+    Return a contiguous flattened array.
+    A 1-D array, containing the elements of the input, is returned.  A copy is
+    made only if needed.
+
+    Parameters
+    ----------
+    x : ndarray
+        Input array.  The elements in `x` are read in row-major, C-style order 
and
+        packed as a 1-D array.
+    out : ndarray or None, optional
+        A location into which the result is stored. If not provided or `None`,
+        a freshly-allocated array is returned.
+
+    Returns
+    -------
+    y : ndarray
+        y is an array of the same subtype as `x`, with shape ``(x.size,)``.
+        Note that matrices are special cased for backward compatibility, if `x`
+        is a matrix, then y is a 1-D ndarray.
+
+    Notes
+    -----
+    This function differs from the original numpy.arange in the following 
aspects:
+        - Only support row-major, C-style order.
+    """
+    if isinstance(x, numeric_types):
+        return _np.reshape(x, -1)
 
 Review comment:
   Removed out.

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

Reply via email to