def position

bendtorch-core@0.1.0.0 · src/tensor/slice_LAWS.bend:323

import bendtorch-core@0.1.0.0/src/tensor/slice_LAWS.bend as SliceLAWS
import Base

323# The cells of the builds, in the coordinates of the views: output cell
324# (o, k, r) of [outer, length, inner] sits at row-major position
325# (o * length + k) * inner + r, and input cell (o, i, r) of [outer, extent,
326# inner] at (o * extent + i) * inner + r.
327def position(+rows: Nat, +inner: Nat, +o: Nat, +i: Nat, +r: Nat) -> Nat:
328  Nat.add(Nat.mul(Nat.add(Nat.mul(o, rows), i), inner), r)

Uses (3)

Used by (7)