NN.Runtime.PyTorch.Import #
Reusable PyTorch weight-import surface.
The general import path is JSON-first:
- PyTorch loads the original checkpoint /
state_dict. - The adapter emitted by
NN.Runtime.PyTorch.Export.StateDictwrites nested-list JSON. Import.Coreparses that JSON into shape-checked TorchLean tensors.
For graphs, the matching path is:
- PyTorch captures an
nn.Modulewith the adapter emitted byNN.Runtime.PyTorch.Export.TorchExport. Import.TorchExportparses the resultingtorchlean.ir.v1graph JSON intoNN.IR.Graph.- The parser runs the shared IR well-formedness and shape checkers before accepting the graph.
Architecture-specific example loaders live beside their fixtures under
NN.Examples.Interop.PyTorch.{MLP,CNN,Transformer}.Import. They may support
serious verification workflows, but they still bake in model-family key conventions and therefore
do not belong in the model-agnostic runtime bridge.