pylibraft.common.device_ndarray#

2 min read time

Applies to Linux

Classes#

device_ndarray

pylibraft.common.device_ndarray is meant to be a very lightweight

Module Contents#

class pylibraft.common.device_ndarray.device_ndarray(np_ndarray)#

pylibraft.common.device_ndarray is meant to be a very lightweight __cuda_array_interface__ wrapper around a numpy.ndarray.

classmethod empty(shape, dtype=numpy.float32, order='C')#

Return a new device_ndarray of given shape and type, without initializing entries.

Parameters#

shapeint or tuple of int

Shape of the empty array, e.g., (2, 3) or 2.

dtypedata-type, optional

Desired output data-type for the array, e.g, numpy.int8. Default is numpy.float32.

order{‘C’, ‘F’}, optional (default: ‘C’)

Whether to store multi-dimensional dat ain row-major (C-style) or column-major (Fortran-style) order in memory

copy_to_host()#

Returns a new numpy.ndarray object on host with the current contents of this device_ndarray

property __cuda_array_interface__#

Returns the __cuda_array_interface__ compliant dict for integrating with other device-enabled libraries using zero-copy semantics.

property c_contiguous#

Is the current device_ndarray laid out in row-major format?

property dtype#

Datatype of the current device_ndarray instance

property f_contiguous#

Is the current device_ndarray laid out in column-major format?

property shape#

Shape of the current device_ndarray instance

property strides#

Strides of the current device_ndarray instance