cupy.ones#

cupy.ones(shape, dtype=<class 'float'>, order='C')[source]#

返回给定形状和数据类型的新数组,并用 1 填充。

此函数目前不支持 order 选项。

参数:
  • shape (intints 元组) – 数组的维度。

  • dtype (数据类型, 可选) – 数据类型说明符。

  • order ({'C', 'F'}) – 行主序 (C 风格) 或列主序 (Fortran 风格)。

返回:

一个填充了 1 的数组。

返回类型:

cupy.ndarray

另请参阅

numpy.ones()