Skip to content

Conflicting types - Unable to transform a ndarray into a PyArray #168

Closed
@Matti88

Description

@Matti88

Hello team. While working with the library I wanted to pass out a PyArray from a function but I am unable to convert a ndarray into a PyArray the following is the error code:

mismatched types

expected struct `ndarray::ArrayBase`, found a different struct `ndarray::ArrayBase`

note: expected struct `ndarray::ArrayBase<ndarray::data_repr::OwnedRepr<_>, _>`
         found struct `ndarray::ArrayBase<ndarray::OwnedRepr<i32>, ndarray::Dim<[usize; 2]>>`
note: perhaps two different versions of crate `ndarray` are being used?rustc(E0308)
lib.rs(76, 58): expected struct `ndarray::ArrayBase`, found a different struct `ndarray::ArrayBase`

yielded from the simple code

let mut return_arr  = Array2::<i32>::zeros((10, 10));
let return_Second_ = PyArray::from_owned_array(_py , return_arr);

I was not able to find in ndarray documentation the type:
ndarray::ArrayBase<ndarray::data_repr::OwnedRepr<_>, _>

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