Skip to main content

DLPackDLTensorFromPyObjectNoSync

Type Alias DLPackDLTensorFromPyObjectNoSync 

Source
pub type DLPackDLTensorFromPyObjectNoSync = Option<unsafe extern "C" fn(py_object: *mut c_void, out: *mut DLTensor) -> c_int>;
Expand description

\brief Exports a PyObject* Tensor/NDArray to a provided DLTensor.

This function provides a faster interface for temporary, non-owning, exchange. The producer (implementor) still owns the memory of data, strides, shape. The liveness of the DLTensor and the data it views is only guaranteed until control is returned.

This function currently assumes that the producer (implementor) can fill in the DLTensor shape and strides without the need for temporary allocations.

This function does not perform any stream synchronization. The consumer should query DLPackCurrentWorkStream to get the current work stream and launch kernels on it.

This function is exposed by the framework through the DLPackExchangeAPI.

\param py_object The Python object to convert. Must have the same type as the one the DLPackExchangeAPI was discovered from. \param out The output DLTensor, whose space is pre-allocated on stack. \return 0 on success, -1 on failure with a Python exception set. \note - As a C function, must not thrown C++ exceptions.

\sa DLPackExchangeAPI, DLPackCurrentWorkStream

Aliased Type§

pub enum DLPackDLTensorFromPyObjectNoSync {
    None,
    Some(unsafe extern "C" fn(*mut c_void, *mut DLTensor) -> i32),
}

Variants§

§1.0.0

None

No value.

§1.0.0

Some(unsafe extern "C" fn(*mut c_void, *mut DLTensor) -> i32)

Some value of type T.