Skip to main content

squeeze

Function squeeze 

Source
pub fn squeeze<T, D>(
    a: &Array<T, D>,
    axis: Option<usize>,
) -> Result<Array<T, IxDyn>, FerrayError>
where T: Element, D: Dimension,
Expand description

Remove axes of length 1 from the shape.

If axis is None, all length-1 axes are removed. If axis is Some(ax), only that axis is removed (errors if it is not length 1).

Analogous to numpy.squeeze().

§Errors

Returns FerrayError::AxisOutOfBounds if the axis is invalid, or FerrayError::InvalidValue if the specified axis has size != 1.