Document NdProducer::raw_dim#918
Conversation
This is useful because, otherwise, users have to manually calculate the shape of the producer to e.g. allocate an array of the correct shape to zip with it.
|
Users can use |
Right; my earlier comment wasn't clear. I'm thinking specifically of a discussion with a user on #rust-sci who wanted to copy windows of an fn windows_to_cols<A>(arr: ArrayView1<'_, A>, window_len: usize) -> Array2<A>
where
A: Clone + Zero,
{
let windows = arr.windows(window_len);
let mut out = Array2::zeros([window_len, windows.raw_dim()[0]].f());
azip!(
(mut col in out.axis_iter_mut(Axis(1)), window in windows)
col.assign(&window)
);
out
}
That would be convenient. |
This is useful because, otherwise, users have to manually calculate the shape of the producer to e.g. allocate an array of the correct shape to zip with it.