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
。
另请参阅
方法
- copy_from(self, in_arr, stream=None)#
将数据从设备或主机数组复制到 CUDA 数组。
- 参数:
in_arr (cupy.ndarray 或 numpy.ndarray) –
stream (cupy.cuda.Stream) – 如果不是
None
,则执行异步复制。
注意
对于具有不同维度的 CUDA 数组,输入数组的形状要求如下
一维:
(nch * width,)
二维:
(height, nch * width)
三维:
(depth, height, nch * width)
其中
nch
是desc
中指定的通道数。
- copy_to(self, out_arr, stream=None)#
将数据从 CUDA 数组复制到设备或主机数组。
- 参数:
out_arr (cupy.ndarray 或 numpy.ndarray) – 必须是 C-contiguous(C 连续)
stream (cupy.cuda.Stream) – 如果不是
None
,则执行异步复制。
注意
对于具有不同维度的 CUDA 数组,输出数组的形状要求如下
一维:
(nch * width,)
二维:
(height, nch * width)
三维:
(depth, height, nch * width)
其中
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#