Documentation

LeanMlir.Proofs.Nets.EfficientNet.EfficientNetFullB0Eval

The full EfficientNet-B0 at inference — all 16 MBConv blocks, eval forward + graph + #

faithfulness

The eval twin of EfficientNetFullB0.lean. That file states the sixteen-block [t,c,n,s,k] net at TRAINING BatchNorm (bnBatchLA), the world its VJP and its typed graph live in; this file states the same ladder at INFERENCE BatchNorm — frozen running statistics at all 49 sites, one shared ε, as the shipped efficientnet_fwd_eval does — and proves its typed SHlo graph denotes it: the graph of efficientnet_fwd_eval.mlir and its 1000-class twin.

Pure enumeration and chaining of EfficientNetStagesPCEval's per-block machinery, at the batched index N·(c·h·w) and generic in the class count. The one block shape added here is the fourth at inference — mbExpFwdBEval / mbExpGraphBEval: expand, stride 1, no residual (ic ≠ oc; the stage-5 and stage-7 first blocks b9/b16) — the eval twin of mbExpFwdB (EfficientNetChainClose.lean).

What it is tied to. efficientnet_fwd_eval.mlir is THIS net: %x plus 213 parameters (the render folds each conv bias into the BatchNorm that follows it, so %sb/%b1db/… have no slot) plus 98 statistic slots — 312 inputs at ten classes, and efficientnetin_fwd_eval.mlir its 1000-class twin. The typed graph uses the artifact's names (folded biases as the shared zero-bias constant, %stnmu/%b{k}{e,d,p}nmu/%hnmu statistics, zW1…zb2 SE denses, %Wd/%bd), and FwdGraphTextTies checks the render's stem, block and head text against it per kind.

B0 stage spec [t,c,n,s,k]: s1 (1,16,1,1,3) s2 (6,24,2,2,3) s3 (6,40,2,2,5) s4 (6,80,3,2,3) s5 (6,112,3,1,5) s6 (6,192,4,2,5) s7 (6,320,1,1,3); stem 3×3/s2 (3→32) at the XLA-SAME phase, head 1×1 (320→1280) → GAP → dense.

noncomputable def Proofs.mbExpFwdBEval (N : ℕ) {ic mid oc h w kHd kWd r : ℕ} (ε : ℝ) (We : Kernel4 mid ic 1 1) (be γe βe μe ve : Vec mid) (Wd : DepthwiseKernel mid kHd kWd) (bd γd βd μd vd : Vec mid) (Wz₁ : Mat mid r) (bz₁ : Vec r) (Wz₂ : Mat r mid) (bz₂ : Vec mid) (Wp : Kernel4 oc mid 1 1) (bp γp βp μp vp : Vec oc) :
Vec (N * (ic * h * w)) → Vec (N * (oc * h * w))

MBConv6 expand, stride 1, no residual, at inference — mbResidFwdBEval's body without the skip (the eval twin of mbExpFwdB).

Equations
  • One or more equations did not get rendered due to their size.
Instances For
    def Proofs.StableHLO.mbExpGraphBEval (p epsStr : String) {N ic mid oc h w kHd kWd r : ℕ} (ε : ℝ) (We : Kernel4 mid ic 1 1) (be γe βe μe ve : Vec mid) (Wd : DepthwiseKernel mid kHd kWd) (bd γd βd μd vd : Vec mid) (Wz₁ : Mat mid r) (bz₁ : Vec r) (Wz₂ : Mat r mid) (bz₂ : Vec mid) (Wp : Kernel4 oc mid 1 1) (bp γp βp μp vp : Vec oc) (e : SHlo (N * (ic * h * w))) :
    SHlo (N * (oc * h * w))

    MBConv6 expand + stride-1 + no-residual inference graph — mbResidGraphBEval without the addV skip.

    Equations
    • One or more equations did not get rendered due to their size.
    Instances For
      theorem Proofs.StableHLO.mbExpGraphBEval_faithful (p epsStr : String) {N ic mid oc h w kHd kWd r : ℕ} (ε : ℝ) (We : Kernel4 mid ic 1 1) (be γe βe μe ve : Vec mid) (Wd : DepthwiseKernel mid kHd kWd) (bd γd βd μd vd : Vec mid) (Wz₁ : Mat mid r) (bz₁ : Vec r) (Wz₂ : Mat r mid) (bz₂ : Vec mid) (Wp : Kernel4 oc mid 1 1) (bp γp βp μp vp : Vec oc) (e : SHlo (N * (ic * h * w))) :
      den (mbExpGraphBEval p epsStr ε We be γe βe μe ve Wd bd γd βd μd vd Wz₁ bz₁ Wz₂ bz₂ Wp bp γp βp μp vp e) = mbExpFwdBEval N ε We be γe βe μe ve Wd bd γd βd μd vd Wz₁ bz₁ Wz₂ bz₂ Wp bp γp βp μp vp (den e)
      structure Proofs.MBWEval (ic mid oc r kh kw : ℕ) :

      Weights and running statistics of one MBConv6 block at inference.

      Instances For
        structure Proofs.MBWNoExpEval (ic oc r kh kw : ℕ) :

        Weights and running statistics of the MBConv1 block (t = 1, no expand) at inference.

        Instances For
          structure Proofs.B0WeightsEval (nCls : ℕ) :

          All of EfficientNet-B0's parameters and running statistics at inference: stem (3×3/s2 3→32)

          • 16 MBConv blocks (the real [t,c,n,s,k] spec, B0Weights's widths) + head (1×1 320→1280)
          • dense (1280→nCls). 49 BatchNorm sites, each with μ/v.
          Instances For
            noncomputable def Proofs.mbNoExpEvalW (N h w : ℕ) (ε : ℝ) {ic oc kh kw r : ℕ} (p : MBWNoExpEval ic oc r kh kw) :
            Vec (N * (ic * h * w)) → Vec (N * (oc * h * w))
            Equations
            Instances For
              noncomputable def Proofs.mbStridedEvalW (N h w : ℕ) (ε : ℝ) {ic mid oc kh kw r : ℕ} (p : MBWEval ic mid oc r kh kw) :
              Vec (N * (ic * (2 * h) * (2 * w))) → Vec (N * (oc * h * w))
              Equations
              Instances For
                noncomputable def Proofs.mbResidEvalW (N h w : ℕ) (ε : ℝ) {c mid kh kw r : ℕ} (p : MBWEval c mid c r kh kw) :
                Vec (N * (c * h * w)) → Vec (N * (c * h * w))
                Equations
                Instances For
                  noncomputable def Proofs.mbExpEvalW (N h w : ℕ) (ε : ℝ) {ic mid oc kh kw r : ℕ} (p : MBWEval ic mid oc r kh kw) :
                  Vec (N * (ic * h * w)) → Vec (N * (oc * h * w))
                  Equations
                  Instances For
                    noncomputable def Proofs.efficientnetForwardBFullEval {nCls : ℕ} (N : ℕ) (ε : ℝ) (w : B0WeightsEval nCls) (x : Vec (N * (3 * 224 * 224))) :
                    Vec (N * nCls)

                    The sixteen-block EfficientNet-B0 inference forward — efficientnetForwardBFull's ladder with frozen running statistics at all 49 BatchNorm sites, at one shared ε. Nested-application form (NOT ∘), as the training twin, so the faithfulness proof closes by rw and rfl.

                    Equations
                    • One or more equations did not get rendered due to their size.
                    Instances For
                      def Proofs.StableHLO.mbNoExpGraphEvalW (pfx epsStr : String) (N h w : ℕ) (ε : ℝ) {ic oc kh kw r : ℕ} (p : MBWNoExpEval ic oc r kh kw) (e : SHlo (N * (ic * h * w))) :
                      SHlo (N * (oc * h * w))
                      Equations
                      Instances For
                        theorem Proofs.StableHLO.mbNoExpGraphEvalW_faithful (pfx epsStr : String) (N h w : ℕ) (ε : ℝ) {ic oc kh kw r : ℕ} (p : MBWNoExpEval ic oc r kh kw) (e : SHlo (N * (ic * h * w))) :
                        den (mbNoExpGraphEvalW pfx epsStr N h w ε p e) = mbNoExpEvalW N h w ε p (den e)
                        def Proofs.StableHLO.mbStridedGraphEvalW (pfx epsStr : String) (N h w : ℕ) (ε : ℝ) {ic mid oc kh kw r : ℕ} (p : MBWEval ic mid oc r kh kw) (e : SHlo (N * (ic * (2 * h) * (2 * w)))) :
                        SHlo (N * (oc * h * w))
                        Equations
                        • One or more equations did not get rendered due to their size.
                        Instances For
                          theorem Proofs.StableHLO.mbStridedGraphEvalW_faithful (pfx epsStr : String) (N h w : ℕ) (ε : ℝ) {ic mid oc kh kw r : ℕ} (p : MBWEval ic mid oc r kh kw) (e : SHlo (N * (ic * (2 * h) * (2 * w)))) :
                          den (mbStridedGraphEvalW pfx epsStr N h w ε p e) = mbStridedEvalW N h w ε p (den e)
                          def Proofs.StableHLO.mbResidGraphEvalW (pfx epsStr : String) (N h w : ℕ) (ε : ℝ) {c mid kh kw r : ℕ} (p : MBWEval c mid c r kh kw) (e : SHlo (N * (c * h * w))) :
                          SHlo (N * (c * h * w))
                          Equations
                          • One or more equations did not get rendered due to their size.
                          Instances For
                            theorem Proofs.StableHLO.mbResidGraphEvalW_faithful (pfx epsStr : String) (N h w : ℕ) (ε : ℝ) {c mid kh kw r : ℕ} (p : MBWEval c mid c r kh kw) (e : SHlo (N * (c * h * w))) :
                            den (mbResidGraphEvalW pfx epsStr N h w ε p e) = mbResidEvalW N h w ε p (den e)
                            def Proofs.StableHLO.mbExpGraphEvalW (pfx epsStr : String) (N h w : ℕ) (ε : ℝ) {ic mid oc kh kw r : ℕ} (p : MBWEval ic mid oc r kh kw) (e : SHlo (N * (ic * h * w))) :
                            SHlo (N * (oc * h * w))
                            Equations
                            • One or more equations did not get rendered due to their size.
                            Instances For
                              theorem Proofs.StableHLO.mbExpGraphEvalW_faithful (pfx epsStr : String) (N h w : ℕ) (ε : ℝ) {ic mid oc kh kw r : ℕ} (p : MBWEval ic mid oc r kh kw) (e : SHlo (N * (ic * h * w))) :
                              den (mbExpGraphEvalW pfx epsStr N h w ε p e) = mbExpEvalW N h w ε p (den e)
                              def Proofs.StableHLO.efficientnetFwdGraphBFullEval {nCls : ℕ} (N : ℕ) (epsStr : String) (ε : ℝ) (w : B0WeightsEval nCls) (x : Vec (N * (3 * 224 * 224))) :
                              SHlo (N * nCls)

                              The sixteen-block EfficientNet-B0 inference forward graph at the batched index N·(c·h·w): stem → 16 MBConv blocks → head → GAP → dense, every one of the 49 BatchNorm sites reading frozen running statistics through the bnEval descriptor. The eval twin of efficientnetFwdGraphBFull, and the typed form of the shipped efficientnet_fwd_eval.

                              Equations
                              • One or more equations did not get rendered due to their size.
                              Instances For
                                theorem Proofs.StableHLO.efficientnetFwdGraphBFullEval_faithful {nCls : ℕ} (N : ℕ) (epsStr : String) (ε : ℝ) (w : B0WeightsEval nCls) (x : Vec (N * (3 * 224 * 224))) :

                                Sixteen-block inference EfficientNet-B0 forward faithfulness. The typed graph denotes efficientnetForwardBFullEval: one rw per block with the *GraphEvalW_faithful lemmas (outermost → innermost), then a structural rfl — the training twin's recipe.