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 — T2 at inference BatchNorm for the paper net, the graph of efficientnet_fwd_eval.mlir and its 1000-class twin. (Built 2026-09-05 so the whole-net float budget could end at a graph; the budget was deleted 2026-09-08 and the graph statement stays — planning/archive/proofs_tier_to_paper_nets.md 3.3(e).)

Pure enumeration and chaining of EfficientNetRenderPCEval.lean's per-block machinery, at the batched index N·(c·h·w) and generic in the class count. The one genuinely new piece is the fourth block shape at inference — mbExpFwdBEval / mbExpGraphBEval: expand, stride 1, no residual (ic ≠ oc; the stage-5 and stage-7 first blocks b9/b16) — which the three-block representative has no instance of and EfficientNetFullB0.lean added at training BN as mbExpFwdB.

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 below inherits the three-block eval graph's SSA names, and they differ from the artifact's in four ways, none of which enters den (names are pretty-printing metadata): the graph carries a bias slot per conv ("%sb", s!"%{p}db", …) that the render folds away; it names the statistic slots %smu/%svar, %b{k}{e,d,p}mu/var, %hmu/%hvar where the artifact has %stnmu/%stnvar, %b{k}{e,d,p}nmu/nvar, %hnmu/%hnvar; it names the SE denses zWa/zba/zWb/zbb where the artifact has zW1/zb1/zW2/zb2; and its classifier is %Wfc/%bfc where the artifact's is %Wd/%bd. The den-level statement is what the number needs; matching the text is a separate, cosmetic pass over EfficientNetRenderPCEval.lean.

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.efficientnetForwardB_fullEval {nCls : } (N : ) (ε : ) (w : B0WeightsEval nCls) (x : Vec (N * (3 * 224 * 224))) :
                    Vec (N * nCls)

                    The sixteen-block EfficientNet-B0 inference forwardefficientnetForwardB_full'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.efficientnetFwdGraphB_fullEval {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 efficientnetFwdGraphB_full, 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.efficientnetFwdGraphB_fullEval_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 efficientnetForwardB_fullEval: one rw per block with the *GraphEvalW_faithful lemmas (outermost → innermost), then a structural rfl — the training twin's recipe.