SciSharp / NumSharp

High Performance Computation for N-D Tensors in .NET, similar API to NumPy.
https://github.com/SciSharp
Apache License 2.0
1.34k stars 187 forks source link

ToBitmap fails if not contiguous because of Broadcast mismatch #475

Open ponzis opened 2 years ago

ponzis commented 2 years ago

When using the public static unsafe Bitmap ToBitmap(this NDArray nd, int width, int height, PixelFormat format = PixelFormat.DontCare) passing a NDArray of shape (1, x, y, 3) fails due to broadcast mismatch at (LeftShape, RightShape) = DefaultEngine.Broadcast(lhs.Shape, rhs.Shape); due to broadcasting with (x*y*3) and (1, x, y, 3) the work around is to clone the NDArray so that it is continues or change the shape of the function so that it has a correct shape.