Skip to content

Add dstack, vstack, and hstack #667

Closed
@ngoldbaum

Description

@ngoldbaum

In the vein of #75 which added stack, it would be really nice if there were a way to easily convert e.g. Vec<Array2<D>> into an Array3<D>. Current I'm doing something like this:

let imshape = data[0].shape()
let mut activation: Array3<f64> = Array3::zeros((n_batch, imshape[0], imshape[1]));
for (i, mm) in data.iter().enumerate() {
    activation.slice_mut(s![i, .., ..]).assign(&m);
}

It would be nice to not have to do this manually, it would also be clearer to people who are used to numpy (IMO).

I think this is equivalent to relaxing the restriction that axis in ndarray::stack has to be an existing axis.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions