VGG-11 and VGG-16 (Diagonal)

This page demonstrates VGG-11 and VGG-16 on CIFAR-10 with the diagonal primitives.

Overview

Every convolution is a 3x3 “same” convolution over channel diagonals, its channels in consecutive blocks. A 2x2 average pooling ends every stage and returns its output on the slots of the next stage.

The activations are kept normalized: every ReLU divides its input by the largest value it holds and returns ReLU(x / s) within [0, 1] (he_relu with a normalized output), so the approximation uses its whole range and the bootstrappings see small values. Each layer divides its bias by the accumulated scale, and the last layer multiplies its weights by it to give the true logits.

Key Functions

The main functions used in this example include:

  • he_convolution() – 3x3 convolution over diagonals.

  • he_avgpool() – 2x2 pooling onto the slots of the next stage (FHEONLayout::outputSlots).

  • he_relu() – Normalized ReLU.

  • he_linear() – Fully connected layers over diagonals.

Full Example Source

You can view and download the full source code of this example:

VGG11Diagonal.cpp

VGG16Diagonal.cpp