---
title: squeezingShape()
framework: coreml
role: symbol
role_heading: Instance Method
path: coreml/mlshapedarrayslice/squeezingshape()
---

# squeezingShape()

Returns a new squeezed shaped array.

## Declaration

```swift
func squeezingShape() -> MLShapedArraySlice<Scalar>
```

## Discussion

Discussion The new shape removes 1s in the original shape. let original = MLShapedArraySlice<Int32>(scalars: 0..., shape: [1, 2, 1, 2]) let squeezed = original.squeezed() squeezed.shape // [2, 2] When all the dimensions of the original shape is one, the resultant shaped array is a scalar. let original = MLShapedArray<Int32>(scalars: 42, shape: [1, 1]) let squeezed = original.squeezed() squeezed.scalar // 42

## See Also

### Shaping the array slice

- [changingLayout(to:)](coreml/mlshapedarrayslice/changinglayout(to:).md)
- [expandingShape(at:)](coreml/mlshapedarrayslice/expandingshape(at:).md)
- [reshaped(to:)](coreml/mlshapedarrayslice/reshaped(to:).md)
- [transposed()](coreml/mlshapedarrayslice/transposed().md)
- [transposed(permutation:)](coreml/mlshapedarrayslice/transposed(permutation:).md)
