Contents

argmax()

Returns the index of the maximum value of the flattened scalars.

Declaration

func argmax() -> MLTensor

Discussion

let x = MLTensor(shape: [3, 2], scalars: [2, 3, 4, 5, 6, 7], scalarType: Float.self)
let y = x.argmax()
y.shape // is []
y.scalarType // is Int32
await y.shapedArray(of: Int32.self) // is 5

See Also

Accessing the indicies