CrownParamstore #
PyTorch → CROWN ParamStore helpers.
This module is not about JSON parsing; it is about what we do after we have already loaded weights into typed Lean tensors.
Why this exists:
- PyTorch “weights” are keyed by module names (
state_dictkeys). - TorchLean’s graph backend stores parameters by node id in
NN.MLTheory.CROWN.Graph.ParamStore.
So any real bridge needs a small amount of “wiring code” that:
- chooses a node-id scheme (model-specific),
- inserts the corresponding
(W,b)tensors into the right slots.
These helpers keep NN.Runtime.PyTorch.Import.Core focused on JSON,
and so model example loaders can share the same ParamStore-building utilities.
Insert one linear layer's parameters at a given node id.
Instances For
Build a ParamStore Float from a list of linear-layer parameters.
nodeIdOfIndex tells us which graph node id corresponds to the i-th layer in the list.
This is the only model-specific decision; the remaining steps are model-agnostic parameter assembly.
Instances For
Instances For
Cast linear parameters from Float to an arbitrary scalar type.
Instances For
Build a ParamStore α from Float parameters by casting each tensor entry with ofFloat.