expandingShape(at:)
Returns a shape-expanded tensor with a dimension of 1 inserted at the specified shape indices.
Declaration
func expandingShape(at axes: Int...) -> MLTensorParameters
- axes:
The axes at which to expand the shape.
Discussion
For example:
let x = MLTensor(shape: [2], scalars: [1, 2], scalarType: Float.self)
let y = x.expandingShape(at: 0)
y.shape // is [1, 2]