def global_index

stelliferous@0.0.2.0 · tensor_band.bend:33

import stelliferous@0.0.2.0/tensor_band.bend as TensorBand
import Base

33# Channel-major local indices map to the same global NCHW index for every
34# partition. A leaf's first row is global across images; rows are image-local.
35def global_index(geometry: Geometry,+first: U32,+rows: U32,+index: U32) -> U32:
36  Geometry{batch,+channels,+height,+width} = geometry
37  +plane = (rows * width : U32)
38  (((first / height * channels + index / plane) * height + first % height) * width + index % plane : U32)

Uses (6)

Used by (1)