cupy.cuda.texture.CUDAarray#

class cupy.cuda.texture.CUDAarray(ChannelFormatDescriptor desc, size_t width, size_t height=0, size_t depth=0, unsigned int flags=0)[源代码]#

分配可作为纹理内存使用的 CUDA 数组 (cudaArray_t)。根据输入,返回一维、二维或三维 CUDA 数组。

参数:
  • desc (ChannelFormatDescriptor) – ChannelFormatDescriptor 的实例。

  • width (int) – 数组的宽度(以元素为单位)。

  • height (int, optional) – 数组的高度(以元素为单位)。

  • depth (int, optional) – 数组的深度(以元素为单位)。

  • flags (int, optional) – 扩展标志。使用 cudaArray* 中的一个值,例如 cupy.cuda.runtime.cudaArrayDefault

警告

由于 CUDA 的限制,CUDAarray 的内存分配在 CuPy 的内存管理(默认启用)之外完成。使用 CUDAarray 的用户应注意任何内存不足的可能性。

另请参阅

cudaMalloc3DArray()

方法

copy_from(self, in_arr, stream=None)#

将数据从设备或主机数组复制到 CUDA 数组。

参数:

注意

对于具有不同维度的 CUDA 数组,输入数组的形状要求如下

  • 一维: (nch * width,)

  • 二维: (height, nch * width)

  • 三维: (depth, height, nch * width)

其中 nchdesc 中指定的通道数。

copy_to(self, out_arr, stream=None)#

将数据从 CUDA 数组复制到设备或主机数组。

参数:

注意

对于具有不同维度的 CUDA 数组,输出数组的形状要求如下

  • 一维: (nch * width,)

  • 二维: (height, nch * width)

  • 三维: (depth, height, nch * width)

其中 nchdesc 中指定的通道数。

__eq__(value, /)#

返回 self==value。

__ne__(value, /)#

返回 self!=value。

__lt__(value, /)#

返回 self<value。

__le__(value, /)#

返回 self<=value。

__gt__(value, /)#

返回 self>value。

__ge__(value, /)#

返回 self>=value。

属性

depth#
desc#
flags#
height#
ndim#
ptr#
width#