# R23 Q1b

Subject: Deep Learning

Exam: TEE

Reader: https://deep-learning-study-room.vercel.app/#tee/read/16/tee-c16-s1

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

## Question

**Question (4 marks).** Apply 3 × 3 average pooling with stride 2 to Matrix 1 shown below. Give the output and justify pooling.

![Given matrices for this question](https://deep-learning-study-room.vercel.app/assets/figures/given_847554ea0e.svg)

Diagram: Given matrices for this question. Labels: GIVEN VALUES — read each matrix row from left to right | Matrix 1 | 1 | 2 | 3 | 2 | 5 | 5 | 3 | 4 | 6 | 3 | 7 | 4 | 8 | 5 | 9 | 8 | 5 | 10 | 4 | 2 | 9 | 10 | 3 | 4 | 3

Given matrices for this question Tap the diagram to enlarge.

## Answer — step by step

### Given

Apply 3 × 3 average pooling with stride 2 to Matrix 1 shown below.

### To find

Find the requested pooled output(s).

### Formula — which one and why

**Pooling.** Max pooling selects the largest window entry. Average pooling adds its entries and divides by their count. Each channel is pooled separately.

V = current pooling window; n = number of entries in that window. Pooling learns no weights or biases.



$$
y_{\max}=\max V
$$





$$
y_{\mathrm{avg}}=\frac1n\sum_{v\in V}v
$$



**Yaad rakhne ka cue:** Max mein biggest; average mein total ÷ window ka count.

### Solution — step by step

**Shape:**   $\left\lfloor\frac{5-3}{2}\right\rfloor+1$  = 2 on each axis; channels stay unchanged.

### Pooling window (1,1)

**Step 1: select the entries.**

[1, 2, 3, 5, 3, 4, 7, 4, 8]

**Step 2: add all selected entries.**

1 + 2 + 3 + 5 + 3 + 4 + 7 + 4 + 8 = 37

**Step 3: divide by the 9 entries in this window.**

37/9 = **4.111111111**

### Pooling window (1,2)

**Step 1: select the entries.**

[3, 2, 5, 4, 6, 3, 8, 5, 9]

**Step 2: add all selected entries.**

3 + 2 + 5 + 4 + 6 + 3 + 8 + 5 + 9 = 45

**Step 3: divide by the 9 entries in this window.**

45/9 = **5**

### Pooling window (2,1)

**Step 1: select the entries.**

[7, 4, 8, 8, 5, 10, 9, 10, 3]

**Step 2: add all selected entries.**

7 + 4 + 8 + 8 + 5 + 10 + 9 + 10 + 3 = 64

**Step 3: divide by the 9 entries in this window.**

64/9 = **7.111111111**

### Pooling window (2,2)

**Step 1: select the entries.**

[8, 5, 9, 10, 4, 2, 3, 4, 3]

**Step 2: add all selected entries.**

8 + 5 + 9 + 10 + 4 + 2 + 3 + 4 + 3 = 48

**Step 3: divide by the 9 entries in this window.**

48/9 = **5.333333333**

**Average output:**   $\begin{bmatrix}4.111111111 & 5\\7.111111111 & 5.333333333\end{bmatrix}$ . Pooling normally has zero trainable parameters and reduces spatial dimensions.
