ResNet-34 (Diagonal)

This page demonstrates ResNet-34 on CIFAR-100 with the diagonal primitives.

Overview

Four stages of basic blocks; the first block of stages 2-4 is a stride-2 block (3x3 convolution + 1x1 shortcut) that halves the width and returns ciphertexts with half the slots. The first layer has 3 input channels: its input is replicated every 4 blocks, so it needs 4 diagonals instead of 16. Keys are kept in one file per stage, as in ResNet20Diagonal.

Key Functions

The main functions used in this example include:

  • he_convolution() – 3x3 convolution over diagonals.

  • he_convolution_and_shortcut_optimized() – Stride-2 block.

  • he_sum_two_ciphertexts() – Residual connection.

  • he_linear() – Final linear layer (100 classes).

Full Example Source

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

ResNet34Diagonal.cpp