numpy.ascontiguousarray(a, dtype=None) [source]
Return a contiguous array in memory (C order).
| Parameters: |
a : array_like Input array. dtype : str or dtype object, optional Data-type of returned array. |
|---|---|
| Returns: |
out : ndarray Contiguous array of same shape and content as |
See also
asfortranarray
require
ndarray.flags
>>> x = np.arange(6).reshape(2,3)
>>> np.ascontiguousarray(x, dtype=np.float32)
array([[ 0., 1., 2.],
[ 3., 4., 5.]], dtype=float32)
>>> x.flags['C_CONTIGUOUS']
True
© 2008–2017 NumPy Developers
Licensed under the NumPy License.
https://docs.scipy.org/doc/numpy-1.14.2/reference/generated/numpy.ascontiguousarray.html