TorchLean API

NN.Examples.Interop.PyTorch.CNN.Import

CNN PyTorch Fixture Import #

CNN fixture weight import from a PyTorch-style state_dict.

We mirror the common PyTorch naming convention for modules:

Each tensor is expected to be encoded as nested JSON arrays whose shape matches the expected TorchLean Shape.

structure Import.CNNPyTorch.CnnStateDict (inC outC kH kW flatSize : ) :

Typed view of a PyTorch state_dict for the demo 2-block CNN.

This matches the keys used by the exporter (conv1.*, conv2.*, fc.*) and pins down the exact shapes expected by TorchLean.

Instances For
    def Import.CNNPyTorch.loadCnnStateDict (inC outC kH kW flatSize : ) (j : Lean.Json) :
    Option (CnnStateDict inC outC kH kW flatSize)

    Load a CNN state dict from JSON (PyTorch state_dict-style keys).

    Instances For