Contents

squeezingShape()

Removes all dimensions of size 1 from the shape of the tensor.

Declaration

func squeezingShape() -> MLTensor

Discussion

For example:

let x = MLTensor(shape: [1, 2, 1], scalars: [1, 2], scalarType: Float.self)
let y = x.squeezingShape()
y.shape // is [2]

See Also

Removing dimensions from the shape of the tensor