argmin(alongAxis:keepRank:)
Returns the indices of the minimum values along the specified axis.
Declaration
func argmin(alongAxis axis: Int, keepRank: Bool = false) -> MLTensorParameters
- axis:
The axis to reduce.
- keepRank:
A Boolean indicating whether to keep the reduced axis or not. The default value is
false.
Return Value
The reduced tensor.
Discussion
let x = MLTensor(shape: [3, 2], scalars: [2, 3, 4, 5, 6, 7], scalarType: Float.self)
let y = x.argmin(alongAxis: 0)
y.shape // is [2]
y.scalarType // is Int32
await y.shapedArray(of: Int32.self) // is 0 0