Function tract_hir::internal::tract_data::internal::tract_ndarray::stack_new_axis

source ยท
pub fn stack_new_axis<A, D>(
    axis: Axis,
    arrays: &[ArrayBase<ViewRepr<&A>, D>]
) -> Result<ArrayBase<OwnedRepr<A>, <D as Dimension>::Larger>, ShapeError>
where A: Clone, D: Dimension, <D as Dimension>::Larger: RemoveAxis,
๐Ÿ‘ŽDeprecated since 0.15.0: Use under the name stack instead.
Expand description

Stack arrays along the new axis.

Errors if the arrays have mismatching shapes. Errors if arrays is empty, if axis is out of bounds, if the result is larger than is possible to represent.

extern crate ndarray;

use ndarray::{arr2, arr3, stack_new_axis, Axis};


let a = arr2(&[[2., 2.],
               [3., 3.]]);
assert!(
    stack_new_axis(Axis(0), &[a.view(), a.view()])
    == Ok(arr3(&[[[2., 2.],
                  [3., 3.]],
                 [[2., 2.],
                  [3., 3.]]]))
);