Skip to main content

allocate_array_on_device

Function allocate_array_on_device 

Source
pub fn allocate_array_on_device(
    shape: &[usize],
    device: DLDevice,
) -> Result<Box<dyn Array>, ParseError>
Expand description

Allocate a new zeroed array on device.

Default builds only allocate on CPU. Non-CPU allocation fails with a clear error (not silent reinterpret as CPU). Callers that already own device memory should use array_from_host_f64_on_device / from_dlpack_f64 to preserve device identity without allocating on the GPU in this process.