pub fn dlpack_from_slice(data: &[f64], shape: &[i64]) -> DLTensorExpand description
Create a DLTensor that borrows data and shape slices.
The returned DLTensor has its data pointer set to data.as_ptr(),
dtype set to float64 (code=2, bits=64), and device set to CPU.
ยงSafety
The returned DLTensor holds raw pointers into data and shape.
Both slices must remain live and unmodified for the entire lifetime of
the returned tensor. The tensor must not be used after either slice drops.
The returned struct does not own the memory it points at; no destructor
is called for data or shape when the DLTensor is dropped.