Docs / nablatensor-tensor / com.nablatensor.tensor.spi

record

BroadcastLayout

Target dimensions and source strides for a broadcast, both left-padded to MAX_RANK with size-1 / stride-0 entries so a kernel can walk them with a fixed-rank loop. An axis that is being broadcast (source extent 1) gets stride 0. Shared by every backend's broadcastTo, which passes the eight values as kernel scalars.

The dims and strides arrays are freshly allocated by of and belong to the caller.

Record components

dims
int[]
strides
int[]

Fields

static final int MAX_RANK

Highest tensor rank the broadcast_to kernels handle.

Methods

static BroadcastLayout of(Shape src, Shape target)

Builds the padded dims / strides for broadcasting src to target. Rejects a target rank above MAX_RANK; the caller handles the src.equals(target) no-op before calling.