squeezingShape(at:)
Removes the specified dimensions of size 1 from the shape of the tensor.
Declaration
func squeezingShape(at axes: Int...) -> MLTensorParameters
- axes:
The axes to remove if the size is
1.
Discussion
For example:
let x = MLTensor(shape: [1, 2, 1], scalars: [1, 2], scalarType: Float.self)
let y = x.squeezingShape(at: 0)
y.shape // is [2, 1]