mindspore.numpy.ravel
- mindspore.numpy.ravel(x)[源代码]
Returns a contiguous flattened tensor.
A 1-D tensor, containing the elements of the input, is returned.
- 参数
x (Tensor) – A tensor to be flattened.
- 返回
Flattened tensor, has the same data type as the original tensor x.
- 异常
TypeError – If x is not tensor.
- Supported Platforms:
Ascend
GPU
CPU
样例
>>> import mindspore.numpy as np >>> x = np.ones((2,3,4)) >>> output = np.ravel(x) >>> print(output.shape) (24,)