本文简要介绍 python 语言中  numpy.ascontiguousarray  的用法。
- 用法:- numpy.ascontiguousarray(a, dtype=None, *, like=None)
- 在内存中返回一个连续数组 (ndim >= 1)(C 顺序)。 - a: array_like
- 输入数组。 
- dtype: str 或 dtype 对象,可选
- 返回数组的数据类型。 
- like: array_like
- 允许创建非 NumPy 数组的引用对象。如果作为 - like传入的类似数组支持- __array_function__协议,则结果将由它定义。在这种情况下,它确保创建一个与通过此参数传入的数组对象兼容的数组对象。
 
- out: ndarray
- 形状和内容相同的连续数组a, 与类型numpy.dtype如果指定。 
 
 - 参数:- 返回:- 例子:- >>> 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- 注意:此函数返回一个至少具有 one-dimension (1-d) 的数组,因此它不会保留 0-d 数组。 
相关用法
- Python numpy asscalar用法及代码示例
- Python numpy asarray_chkfinite用法及代码示例
- Python numpy asanyarray用法及代码示例
- Python numpy asarray用法及代码示例
- Python numpy asmatrix用法及代码示例
- Python numpy asfortranarray用法及代码示例
- Python numpy asfarray用法及代码示例
- Python numpy any用法及代码示例
- Python numpy argpartition用法及代码示例
- Python numpy arctan用法及代码示例
- Python numpy array用法及代码示例
- Python numpy array_repr用法及代码示例
- Python numpy arccos用法及代码示例
- Python numpy all用法及代码示例
- Python numpy add用法及代码示例
- Python numpy around用法及代码示例
- Python numpy array2string用法及代码示例
- Python numpy atleast_1d用法及代码示例
- Python numpy arctan2用法及代码示例
- Python numpy angle用法及代码示例
- Python numpy arctanh用法及代码示例
- Python numpy apply_over_axes用法及代码示例
- Python numpy arccosh用法及代码示例
- Python numpy arange用法及代码示例
- Python numpy argsort用法及代码示例
注:本文由纯净天空筛选整理自numpy.org大神的英文原创作品 numpy.ascontiguousarray。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。
