TorchLean API

NN.MLTheory.CROWN.Graph.Core

CROWN Graph #

Graph-based LiRPA scaffolding (IBP + CROWN-style affine bounds).

This file is the "graph engine" counterpart to NN.MLTheory.CROWN.Core:

What this module is for:

Design notes:

References:

PyTorch analogues (conceptual):

@[reducible, inline]

Alias for the typed IR computation graph used by the CROWN/LiRPA engines.

Instances For
    def NN.MLTheory.CROWN.FlatBox.lInfBox {α : Type} [Context α] {s : Spec.Shape} (center radius : Spec.Tensor α s) :

    Flatten a shaped center/radius pair into the graph-level interval-box representation.

    Instances For
      def NN.MLTheory.CROWN.FlatBox.lInfBall {α : Type} [Context α] {s : Spec.Shape} (center : Spec.Tensor α s) (eps : α) :

      Uniform ℓ∞ box around a shaped tensor.

      Instances For
        @[reducible, inline]

        Alias for the IR node kind enumeration used by the graph engine.

        Instances For
          @[reducible, inline]

          Alias for the IR node record used by the graph engine.

          Instances For

            Flattened affine form for a node output with respect to a fixed flattened input.

            This represents y ≈ A*x + c for a chosen input node x.

            • inDim :

              Flattened input dimension.

            • outDim :

              Flattened output dimension.

            • aff : AffineVec α self.inDim self.outDim

              Affine form A,c.

            Instances For

              Flattened affine lower and upper bounds for a node output w.r.t. a fixed flattened input.

              Instances For

                Evaluate a flattened affine form on a flattened input box after checking the input dimension.

                Instances For
                  def NN.MLTheory.CROWN.Graph.FlatAffine.evalOnFlatBoxAsDim {α : Type} [Context α] [BoundOps α] (aff : FlatAffine α) (xB : FlatBox α) (hIn : xB.dim = aff.inDim) {m : } (hOut : aff.outDim = m) :

                  Evaluate and view the output at a checked vector dimension.

                  Instances For

                    Evaluate lower/upper affine bounds on a flattened input box.

                    The lower affine form contributes the lower endpoint; the upper affine form contributes the upper endpoint. This is the common CROWN workflow shape.

                    Instances For
                      def NN.MLTheory.CROWN.Graph.FlatAffineBounds.evalOnFlatBoxAsDim {α : Type} [Context α] [BoundOps α] (bounds : FlatAffineBounds α) (xB : FlatBox α) (hIn : xB.dim = bounds.inDim) {m : } (hOut : bounds.outDim = m) :

                      Evaluate lower/upper affine bounds and view the output at a checked vector dimension.

                      Instances For

                        Per-node bound state (flattened).

                        The option fields record which analyses have populated a node: an interval-only pass fills ibp?, while affine CROWN passes additionally fill aff?.

                        Instances For

                          Propagation workspace across the whole graph.

                          • inputId :

                            Which node id is treated as the designated input for affine bounds.

                          • inputDim :

                            Flattened input dimension.

                          • states : Array (NodeState α)

                            Per-node bound states.

                          Instances For