def row_max
import bendtorch-core@0.1.0.0/src/autograd/loss.bend as Lossimport Base
100# The maximum of row `row` of a row-major [rows, columns] array: its first
101# word, then max_step with each later word, left to right. A row of no
102# words is -inf (0xFF800000).
103def row_max(+columns: Nat, +row: Nat, array: Array<F32>) -> F32 & Array<F32>:
104 match columns:
105 case 0n:
106 (from_word(4286578688), array)
107 case 1n+less:
108 row_first(1n+less, Nat.mul(row, 1n+less), Array.get(F32, array, U32.from_nat(Nat.mul(row, 1n+less))))