MCPcopy Create free account
hub / github.com/YuminosukeSato/ironkernel / asarray_from_numpy

Function asarray_from_numpy

src/python/py_buffer.rs:55–58  ·  view source on GitHub ↗

Create a Buffer from a numpy array (zero-copy for contiguous f64).

(array: PyReadonlyArray1<f64>)

Source from the content-addressed store, hash-verified

53
54/// Create a Buffer from a numpy array (zero-copy for contiguous f64).
55pub fn asarray_from_numpy(array: PyReadonlyArray1<f64>) -> Buffer {
56 let slice = array.as_slice().expect("contiguous array required");
57 Buffer::from_f64_vec(slice.to_vec())
58}
59
60#[cfg(test)]
61mod tests {

Calls

no outgoing calls