Index maps¶
The layout of every tensor-typed parameter a transpiled program reads, axis by axis, with the
coordinate at each position. qvr transpile --index-map FILE writes it as JSON.
axis_layout
¶
The index map a transpiled program's arrays are laid out by.
Every transpile target reads tensors positionally: axis names stop at the
first-order boundary (erase_axes). An array
whose type has axes named by finite types is laid out in the canonical order
that type fixes (canonical_dimensions),
and the index map records that order: for each program and computation
parameter of tensor type, its axes in layout order, each with its name, its
extent, and its coordinate labels in position order. A caller lays data out
for a target by the map, and reads a target's results back by it.
qvr transpile --index-map FILE writes the map as JSON beside the
transpiled program.
IndexedAxis
didactic-model
¶
IndexedAxis(*, name: str, extent: int | None, coordinates: tuple[str, ...] = (), named: bool = False)
Bases: Model
One axis of a parameter's array, in layout order.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
The axis's name: the finite type's rendering, or
TYPE:
|
extent
|
Its extent, when the type fixes it.
TYPE:
|
coordinates
|
The coordinate label at each position, when the extent is fixed.
TYPE:
|
named
|
Whether a finite type names the axis.
TYPE:
|
IndexedParameter
didactic-model
¶
IndexedParameter(*, entry: str, parameter: str, type: str, axes: tuple[IndexedAxis, ...])
Bases: Model
The layout of one tensor-typed parameter.
| PARAMETER | DESCRIPTION |
|---|---|
entry
|
The program or computation the parameter belongs to.
TYPE:
|
parameter
|
The parameter's name.
TYPE:
|
type
|
Its type, as source spells it.
TYPE:
|
axes
|
Its axes, outermost first.
TYPE:
|
IndexMap
didactic-model
¶
IndexMap(*, parameters: tuple[IndexedParameter, ...] = ())
Bases: Model
The layout of every tensor-typed parameter of a module.
| PARAMETER | DESCRIPTION |
|---|---|
parameters
|
One record per tensor-typed parameter of each program and computation, in declaration order.
TYPE:
|
to_json
¶
The map as JSON text.
| RETURNS | DESCRIPTION |
|---|---|
str
|
|
Source code in src/quivers/transpile/axis_layout.py
index_map
¶
index_map(module: QiecModule) -> IndexMap
The index map of a checked module's tensor-typed parameters.
| PARAMETER | DESCRIPTION |
|---|---|
module
|
The checked module, before the first-order boundary erases its axis names.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
IndexMap
|
The layout of every tensor-typed program and computation parameter. |