TorchLean API

NN.MLTheory.CROWN.Operators.Pooling

Pooling operator bounds #

This file provides simple interval-bound-propagation (IBP) transfer rules for 2D max/average pooling. These rules are used by the graph-level CROWN/LiRPA development when a model contains pooling operators.

References #

Configuration for 2D pooling.

This matches the common (kernel, stride, padding) parameters used by deep-learning libraries.

  • kH :

    Kernel height.

  • kW :

    Kernel width.

  • stride :

    Stride (used for both height and width).

  • padding :

    Padding (used for all sides).

Instances For
    def NN.MLTheory.CROWN.Operators.poolOutputSize (inSize padding kSize stride : ) :

    Compute output dimensions for pooling

    Instances For

      Max Pooling IBP #

      For max pooling, the interval bounds are:

      We use Numbers.neg_thousand as a practical lower bound for initialization since the Context typeclass doesn't provide negative infinity.

      def NN.MLTheory.CROWN.Operators.get2D {α : Type} {h w : } (t : Spec.Tensor α (Spec.Shape.dim h (Spec.Shape.dim w Spec.Shape.scalar))) (i j : ) (default : α) :
      α

      Get element from 2D tensor with bounds checking, returns default if out of bounds

      Instances For

        IBP for MaxPool2D on a single channel 2D input. Input shape: (H, W), Output shape: (outH, outW)

        Instances For

          Average Pooling IBP #

          For average pooling, the interval bounds are:

          IBP for AvgPool2D on a single channel 2D input.

          Instances For

            Global Pooling #

            Global max/average pooling reduces entire spatial dimensions to a single value.

            def NN.MLTheory.CROWN.Operators.get3D {α : Type} {c h w : } (t : Spec.Tensor α (Spec.Shape.dim c (Spec.Shape.dim h (Spec.Shape.dim w Spec.Shape.scalar)))) (ch i j : ) (default : α) :
            α

            Get element from 3D tensor (C, H, W)

            Instances For

              IBP for Global Average Pooling

              Instances For