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)。根据输入,返回的可能是 1D、2D 或 3D 的 CUDA 数组。
- 参数:
desc (ChannelFormatDescriptor) – 一个
ChannelFormatDescriptor的实例。width (int) – 数组的宽度(以元素为单位)。
height (int, optional) – 数组的高度(以元素为单位)。
depth (int, optional) – 数组的深度(以元素为单位)。
flags (int, optional) – 扩展的标志。使用
cudaArray*中的一个值,例如cupy.cuda.runtime.cudaArrayDefault。
方法
- copy_from(self, in_arr, stream=None)#
从设备或主机数组复制数据到 CUDA 数组。
- 参数:
in_arr (cupy.ndarray or numpy.ndarray) –
stream (cupy.cuda.Stream) – 如果不是
None,则执行异步复制。
备注
对于具有不同维度的CUDA数组,输入数组的形状要求如下:
1D:
(nch * width,)2D:
(高度, nch * 宽度)3D:
(深度, 高度, nch * 宽度)
其中
nch是在desc中指定的通道数。
- copy_to(self, out_arr, stream=None)#
将数据从CUDA数组复制到设备或主机数组。
- 参数:
out_arr (cupy.ndarray or numpy.ndarray) – 必须是 C 连续的
stream (cupy.cuda.Stream) – 如果不是
None,则执行异步复制。
备注
对于具有不同维度的CUDA数组,输出数组的形状要求如下:
1D:
(nch * width,)2D:
(高度, nch * 宽度)3D:
(深度, 高度, nch * 宽度)
其中
nch是在desc中指定的通道数。
- __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#