pub unsafe fn array_from_dlpack_f32<'a>(
tensor: *const DLTensor,
) -> Result<ArrayViewD<'a, f32>, DlpackError>Expand description
Generic DLPack array construction — accepts f32 tensors from any framework.
Builds an ndarray view backed by the tensor’s data pointer. Only CPU
tensors are supported; non-CPU tensors return DlpackError::NonCpuDevice.
§Safety
The caller must guarantee that:
tensoris a valid, aligned, non-null pointer to aDLTensor.- The tensor’s
datafield points to at leastproduct(shape) * 4bytes of validf32values in native byte order. - The tensor remains live and unmodified for the lifetime of the returned
view
'a.
§Errors
Returns DlpackError if the tensor is not CPU-resident or not f32.