def operands_below

bendtorch-core@0.1.0.0 · src/autograd/backward.bend:174

import bendtorch-core@0.1.0.0/src/autograd/backward.bend as Backward
import Base

174def operands_below(node: Node, +bound: Nat) -> Bool:
175  match node:
176    case Leaf{}:
177      True{}
178    case Add{a, b}:
179      Bool.and(Nat.is_lt(a, bound), Nat.is_lt(b, bound))
180    case Sub{a, b}:
181      Bool.and(Nat.is_lt(a, bound), Nat.is_lt(b, bound))
182    case Mul{a, b, left, right}:
183      Bool.and(Nat.is_lt(a, bound), Nat.is_lt(b, bound))
184    case Neg{a}:
185      Nat.is_lt(a, bound)

Uses (5)

Used by (3)