# Faculty Assignment2 Q5 · 32×32 three-convolution CNN

Subject: Deep Learning

Exam: TEE

Reader: https://deep-learning-study-room.vercel.app/#tee/read/22/tee-c22-s4

Canonical: https://deep-learning-study-room.vercel.app/read/dl/tee/section/tee-c22-s4/

## Question

**Question. Input32×32×1; conv3,8same; pool2stride2; conv5,16valid; pool2stride2; conv3,32same; dense64; output5. Find shapes and parameters.** (Faculty assignment: no marks printed)

## Answer — step by step

### Given

Input=[32, 32, 1]

| Layer | Kernel | Stride | Padding | Filters / units |
| --- | --- | --- | --- | --- |
| Conv | 3 | 1 | 1 | 8 |
| Pool | 2 | 2 | 0 | 0 |
| Conv | 5 | 1 | 0 | 16 |
| Pool | 2 | 2 | 0 | 0 |
| Conv | 3 | 1 | 1 | 32 |
| Dense | 0 | 0 | 0 | 64 |
| Dense | 0 | 0 | 0 | 5 |

### To find

Each output shape and all trainable weights plus biases.

### Formula: which one and why



$$
O=\left\lfloor\frac{N+2P-F}{S}\right\rfloor+1
$$





$$
P_{conv}=(F_hF_wC_{in}+1)C_{out},\quad P_{dense}=(n_{in}+1)n_{out}
$$



Each filter/unit has one bias. Pooling has zero learned parameters. Flatten preserves the number of values, then a dense layer connects every input value to every output unit.

### Step 1. Work layer by layer

| Layer | Input | Full substitution and reason | Output | Parameters |
| --- | --- | --- | --- | --- |
| Conv | 32×32×1 | ⌊(32+2×1−3)/1⌋+1=32; parameters=(3×3×1+1)×8=80 | 32×32×8 | 80 |
| Pool | 32×32×8 | ⌊(32−2)/2⌋+1=16; channels stay 8; no trainable weights | 16×16×8 | 0 |
| Conv | 16×16×8 | ⌊(16+2×0−5)/1⌋+1=12; parameters=(5×5×8+1)×16=3216 | 12×12×16 | 3216 |
| Pool | 12×12×16 | ⌊(12−2)/2⌋+1=6; channels stay 16; no trainable weights | 6×6×16 | 0 |
| Conv | 6×6×16 | ⌊(6+2×1−3)/1⌋+1=6; parameters=(3×3×16+1)×32=4640 | 6×6×32 | 4640 |
| Dense | 6×6×32 | Flatten/input length=6×6×32=1152; parameters=(1152+1)×64=73792 | 64 | 73792 |
| Dense | 1×1×64 | Flatten/input length=1×1×64=64; parameters=(64+1)×5=325 | 5 | 325 |

### Step 2. Sum only trainable parameters

80 + 3216 + 4640 + 73792 + 325 = 82053

### Final answer

**Total parameters=82053.** Shape and parameter count are separate results.
