[K/N] Replaced usage of minBy/maxBy in samples and benchmarks

This commit is contained in:
Elena Lepilkina
2021-04-08 08:31:26 +03:00
committed by Pavel Punegov
parent d2d324797b
commit 53c80cf03b
2 changed files with 2 additions and 2 deletions
@@ -17,7 +17,7 @@ fun Float.toRoundedString(digits: Int = 0): String {
fun Float.toPercentageString(roundToDigits: Int = 1) = (this * 100).toRoundedString(roundToDigits)
fun List<Float>.maxIndex() = withIndex().maxBy { it.value }!!.index
fun List<Float>.maxIndex() = withIndex().maxByOrNull { it.value }!!.index
fun accuracy(predictionBatch: FloatMatrix, labelBatch: FloatMatrix): Float {
val resultIndexes = predictionBatch.toList().map { it.maxIndex() }