def entry

bendtorch-core@0.1.0.0 · src/tensor/gather.bend:239

import bendtorch-core@0.1.0.0/src/tensor/gather.bend as Gather
import Base

239# Output cell `at` is (o, k, r) of [outer, length, inner]; with entry j, it
240# reads input cell (o, j, r) of [outer, extent, inner].
241def entry(+plan: Plan, +at: Nat) -> Nat:
242  Plan{+kind, +outer, +extent, +inner, +length} = plan
243  +row = Nat.div(at, inner)
244  entry_of(kind, length, inner, Nat.div(row, length), Nat.mod(row, length), Nat.mod(at, inner))

Uses (5)

Used by (5)