TorchLean API

NN.Runtime.PyTorch.Import.CNN

CNN PyTorch Reference Import #

CNN reference 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.PyTorch.CNN.Parameters (inputChannels outputChannels kernelHeight kernelWidth flattenedWidth : ) :

Parameters for the example two-block CNN imported from a PyTorch state_dict.

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

Instances For
    def Import.PyTorch.CNN.load (inputChannels outputChannels kernelHeight kernelWidth flattenedWidth : ) (json : Lean.Json) :
    Option (Parameters inputChannels outputChannels kernelHeight kernelWidth flattenedWidth)

    Load CNN parameters from JSON using PyTorch state_dict keys.

    Instances For