rust-numpy icon indicating copy to clipboard operation
rust-numpy copied to clipboard

returned pyarray not able to convert to vec

Open DennisZhangOiler opened this issue 1 year ago • 0 comments

my code:

let inverted = test
            .call1(PyTuple::new_bound(py, &[a]))
            .unwrap()
            .downcast_into::<PyArray3<u8>>()
            .unwrap();
        println!(
            "inverted shape: {:?}, len: {}",
            inverted.shape(),
            inverted.len()
        );
        let v = inverted.to_vec().unwrap();
        println!("inverted vector size: {:?}", v.len());

output:

inverted shape: [360, 640, 3], len: 691200
thread 'main' panicked at src/main.rs:117:46:
called `Result::unwrap()` on an `Err` value: NotContiguousError
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

DennisZhangOiler avatar Nov 05 '24 08:11 DennisZhangOiler