TorchLean API

NN.Spec.Module.Conv

Convolution module wrappers #

This file exposes conv specs as NNModuleSpecs.

Compatibility wrappers for Conv2D and ConvTranspose2D are consolidated here with their public names.

Conv2D #

def Spec.Conv2DModuleSpec {α : Type} [Context α] {inC outC kH kW stride padding inH inW : } {h1 : inC 0} {h2 : kH 0} {h3 : kW 0} (m : Conv2DSpec inC outC kH kW stride padding α h1 h2 h3) :
ModSpec.NNModuleSpec α (Shape.dim inC (Shape.dim inH (Shape.dim inW Shape.scalar))) (Shape.dim outC (Shape.dim ((inH + 2 * padding - kH) / stride + 1) (Shape.dim ((inW + 2 * padding - kW) / stride + 1) Shape.scalar)))

Wrap conv2d_spec as an NNModuleSpec, with the output shape computed in the type.

Instances For

    ConvTranspose2D #

    def Spec.ConvTranspose2DModuleSpec {α : Type} [Context α] {inC outC kH kW stride padding inH inW : } {h1 : inC > 0} {h2 : kH 0} {h3 : kW 0} (m : ConvTranspose2DSpec inC outC kH kW stride padding α h1 h2 h3) :
    ModSpec.NNModuleSpec α (Shape.dim inC (Shape.dim inH (Shape.dim inW Shape.scalar))) (Shape.dim outC (Shape.dim ((inH - 1) * stride - 2 * padding + kH) (Shape.dim ((inW - 1) * stride - 2 * padding + kW) Shape.scalar)))

    ConvTranspose2D wrapper as an NNModuleSpec (output shape encoded at the type level).

    Instances For