def targets_fit

bendtorch-core@0.1.0.0 · src/autograd/loss.bend:261

import bendtorch-core@0.1.0.0/src/autograd/loss.bend as Loss
import Base

261# Whether every target is below `columns`, and there are `rows` of them.
262def targets_fit(+targets: List<&2, U32>, +rows: Nat, +columns: Nat) -> Bool:
263  match targets rows:
264    case Nil{} 0n:
265      True{}
266    case Con{+target, +rest} 1n+below:
267      Bool.and(Nat.is_lt(U32.to_nat(target), columns), targets_fit(rest, below, columns))
268    case _ _:
269      False{}

Uses (7)

Used by (1)