TorchLean API

NN.Verification.PINN.PyTorch.Load

PINN PyTorch Checkpoint Loading #

PINN weight import (JSON → typed tensors).

This is the “loading” half of the PINN PyTorch bridge:

The generic JSON helpers (loadWeights?, parseTensor, inferMatrixDims, …) live in NN/Runtime/PyTorch/Import/Core.lean.

One fully-connected layer of a PINN (weights + bias) as trained in PyTorch.

Instances For

    A parsed PINN state dict together with the inferred TorchLean sequential PINN architecture.

    Instances For

      Activation metadata #

      Python training scripts often record which nonlinearity they used. We treat that as optional metadata under meta.activation. If it is missing we default to tanh; an unrecognized value rejects the checkpoint instead of silently bounding it as a tanh network.

      Parse optional activation metadata from JSON (meta.activation).

      An absent meta object or activation field selects tanh. A present value must name a supported nonlinearity (tanh, relu, or sin/sine/siren); anything else fails the load.

      Instances For

        Load a PINN state dict with arbitrary hidden widths.

        Expected keys:

        • layers.<i>.weight and layers.<i>.bias for each layer index i
        • optional meta.activation (see Internal.parseActivation; unsupported values reject)

        Unlike fixed-shape examples, we infer (outDim, inDim) for each layer from the JSON matrix shape.

        Instances For