PyO3 / PyO3/rust-numpy

returned pyarray not able to convert to vec

Open
#468 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
1.4k
Forks
141
Avg merge
16m
Merged PRs (30d)
3

Description

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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with src/main.rs at line 117 and the PyArray3 conversion shown in the report. Reproduce the NotContiguousError from to_vec() and inspect the reported array shape, length, and contiguity. Done means documenting or confirming the supported behavior for converting this returned array to a vector.

Written by the indexing model from the issue text.

Assessment

Tech stack
numpy, rust
Domain
data
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.