Skip to content

returned pyarray not able to convert to vec #468

Open
@DennisZhangOiler

Description

@DennisZhangOiler

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions