Skip to content
heliaEDGE
Reference
HELIA

mapping

Declarative weight mappings from a source file to a Keras model; importable without Keras.

Machine-readable model

  • SHA256constant
  • Transformattribute
  • TransposeclassPermute the axes, as numpy.transpose.
  • ReshapeclassReshape in C order, as numpy.reshape.
  • GateReorderclassReorder equal gate blocks along axis, for example ONNX LSTM "iofc" to Keras "ifco".
  • SplitclassTake part index of parts equal parts along axis.
  • SumPartsclassAdd parts equal parts along axis, for example an ONNX LSTM's input and recurrent biases.
  • WeightRowclassOne model weight: its source tensors, how they combine, and the transforms to its layout.
  • SourceFormatclassFile formats importweights reads (see heliaedge.importers.readers).
  • SourcePinclassThe one source file a mapping was written for.
  • WeightMappingclassEvery weight of one architecture, from one source format.
class

Transpose

Python

Permute the axes, as numpy.transpose.

helia_edge/importers/mapping.py:13

Transpose()

Permute the axes, as numpy.transpose.

class

Reshape

Python

Reshape in C order, as numpy.reshape.

helia_edge/importers/mapping.py:25

Reshape()

Reshape in C order, as numpy.reshape.

class

Reorder equal gate blocks along axis, for example ONNX LSTM "iofc" to Keras "ifco".

helia_edge/importers/mapping.py:37

GateReorder()

Reorder equal gate blocks along axis, for example ONNX LSTM "iofc" to Keras "ifco".

source and target name the same gates, one letter each, in their stored orders.

class

Split

Python

Take part index of parts equal parts along axis.

helia_edge/importers/mapping.py:63

Split()

Take part index of parts equal parts along axis.

A source tensor may feed several rows only through splits that together use every part once.

class

SumParts

Python

Add parts equal parts along axis, for example an ONNX LSTM's input and recurrent biases.

helia_edge/importers/mapping.py:88

SumParts()

Add parts equal parts along axis, for example an ONNX LSTM’s input and recurrent biases.

class

WeightRow

Python

One model weight: its source tensors, how they combine, and the transforms to its layout.

helia_edge/importers/mapping.py:106

WeightRow()

One model weight: its source tensors, how they combine, and the transforms to its layout.

attribute

combine

Python

helia_edge/importers/mapping.py:126

combine: Literal['sum', 'concat'] | None = None

sum (for example an LSTM’s input and recurrent biases) or concat along concat_axis; required with several sources.

attribute

weight

Python

helia_edge/importers/mapping.py:130

weight: str

Name of the weight within the layer, such as kernel or bias, or its path inside a composite layer, such as query/kernel in a MultiHeadAttention.

attribute

helia_edge/importers/mapping.py:131

source_shape: tuple[Annotated[int, Field(ge=0)], ...] | None = None

The shape every source tensor must have, checked before combine and transforms; None checks only the final shape. A Reshape alone cannot tell a transposed source of the same size from the right one.

method

value

Python

This row's weight value from the source tensors.

helia_edge/importers/mapping.py:151

value(tensors: dict[str, npt.NDArray]) -> npt.NDArray

This row’s weight value from the source tensors.

class

SourcePin

Python

The one source file a mapping was written for.

helia_edge/importers/mapping.py:173

SourcePin()

The one source file a mapping was written for.

class

Every weight of one architecture, from one source format.

helia_edge/importers/mapping.py:184

WeightMapping()

Every weight of one architecture, from one source format.