Contents

squeezeAxis

Squeeze the tensor at the specified dimension.

Declaration

static var squeezeAxis: any MLTensorRangeExpression { get }

Discussion

For example:

let x = MLTensor(randomNormal: [1, 3, 28, 28], scalarType: Float.self)
let y = x[.squeezeAxis, ...]
y.shape // is [3, 28, 28]

See Also

Expanding and squeezing the tensor