TorchLean API

NN.Runtime.Autograd.Model.Layers.ConvPool

TorchLean NN: Convolution and Pooling Layers #

Reject zero spatial, kernel, or stride extents, identifying the layer in the error message.

Instances For
    def Runtime.Autograd.Model.Layers.conv (batchSize rank inputChannels outputChannels : ℕ) (kernelSize stride padding inputSize : TorchLean.Tensor ℕ [rank]) (weightSeed : ℕ := 0) (weightInit : Torch.Init.Scheme := Torch.Init.Scheme.uniform (-0.1) 0.1) :
    Layer (((inputSize.to Spec.Shape).prependDim inputChannels).prependDim batchSize) ((((Spec.convOutSpatial inputSize kernelSize stride padding).to Spec.Shape).prependDim outputChannels).prependDim batchSize)

    N-D convolution layer for a channels-first tensor (batch, inputChannels, spatial...).

    Parameters:

    • weight: (outputChannels × inputChannels × kernelSize[0] × ... × kernelSize[rank-1]),
    • bias: (outputChannels).

    The output spatial shape is computed from (stride, padding, kernelSize).

    PyTorch analogy: torch.nn.Conv{d}d / torch.nn.functional.conv{d}d with groups=1 and dilation=1.

    Instances For
      def Runtime.Autograd.Model.Layers.convTranspose (batchSize rank inputChannels outputChannels : ℕ) (kernelSize stride padding inputSize : TorchLean.Tensor ℕ [rank]) (weightSeed : ℕ := 0) (weightInit : Torch.Init.Scheme := Torch.Init.Scheme.uniform (-0.1) 0.1) :
      Layer (((inputSize.to Spec.Shape).prependDim inputChannels).prependDim batchSize) ((((Spec.convTransposeOutSpatial inputSize kernelSize stride padding).to Spec.Shape).prependDim outputChannels).prependDim batchSize)

      N-D transpose convolution layer for a channels-first tensor (batch, inputChannels, spatial...).

      Parameters:

      • weight: (inputChannels × outputChannels × kernelSize[0] × ... × kernelSize[rank-1]),
      • bias: (outputChannels).

      The output spatial shape uses: output[a] = (input[a] - 1) * stride[a] - 2 * padding[a] + kernelSize[a] (with output_padding = 0).

      PyTorch analogy: torch.nn.ConvTranspose{d}d / torch.nn.functional.conv_transpose{d}d with groups=1, dilation=1, and output_padding=0.

      Instances For
        def Runtime.Autograd.Model.Layers.maxPool (batchSize rank channels : ℕ) (kernelSize stride padding inputSize : TorchLean.Tensor ℕ [rank]) :
        Layer (((inputSize.to Spec.Shape).prependDim channels).prependDim batchSize) ((((Spec.poolOutSpatialPad inputSize kernelSize stride padding).to Spec.Shape).prependDim channels).prependDim batchSize)

        N-D max pooling layer for a channels-first tensor (batch, channels, spatial...).

        Output spatial dimensions follow Spec.poolOutSpatialPad.

        PyTorch analogy: torch.nn.functional.max_pool{d}d on an N×C×... tensor.

        Instances For
          def Runtime.Autograd.Model.Layers.avgPool (batchSize rank channels : ℕ) (kernelSize stride padding inputSize : TorchLean.Tensor ℕ [rank]) :
          Layer (((inputSize.to Spec.Shape).prependDim channels).prependDim batchSize) ((((Spec.poolOutSpatialPad inputSize kernelSize stride padding).to Spec.Shape).prependDim channels).prependDim batchSize)

          N-D average pooling layer for a channels-first tensor (batch, channels, spatial...).

          PyTorch analogy: torch.nn.functional.avg_pool{d}d on an N×C×... tensor.

          Instances For