You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
when I use numpy::inner(), I face the following problem, float64' object cannot be converted to 'PyArray<T, D>
here is my code let array = numpy::pyarray![py, 1.0, 2.0, 3.0]; let inner: &numpy::PyArray0::<_> = numpy::inner(array, array).unwrap(); println!("{}",inner.item());
The text was updated successfully, but these errors were encountered:
adamreichold
changed the title
the type of pyarray is f64 in numpy::innner()
Type signature of numpy::innner does not cover all cases
Mar 5, 2022
I can confirm that this issue happens with arrays of element type f64, but not with arrays of element type i32, i.e. NumPy's effective type signature is more dynamic than our
and we need to figure out how to extend this to cover this case. (While I understand that it is not a problem for Python itself, this inconsistency seems somewhat unfortunate.)
@pickanameforlove As a workaround, I think you should be able to use ndarray's ArrayBase::dot to compute the inner product of two vectors as long as they are real-valued. (I would always recommend to use ndarray functions if they get the job done.)
when I use numpy::inner(), I face the following problem,
float64' object cannot be converted to 'PyArray<T, D>
here is my code
let array = numpy::pyarray![py, 1.0, 2.0, 3.0]; let inner: &numpy::PyArray0::<_> = numpy::inner(array, array).unwrap(); println!("{}",inner.item());
The text was updated successfully, but these errors were encountered: