# R24 Q1d

Subject: Deep Learning

Exam: MT2

Reader: https://deep-learning-study-room.vercel.app/#mt2/read/14/mt2-c14-s1

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

## Question

**Question (5 marks).** For feature map Matrix 1 shown below, find max and average pooling with 2 × 2 windows, stride 2.

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

Diagram: Given matrices for this question. Labels: GIVEN VALUES — read each matrix row from left to right | Matrix 1 | 21 | 11 | 15 | 10 | 12 | 9 | 10 | 11 | 11 | 13 | 18 | 12 | 7 | 4 | 15 | 12

Given matrices for this question Tap the diagram to enlarge.

## Answer — step by step

### Given

For feature map Matrix 1 shown below, find max and average pooling with 2 × 2 windows, stride 2.

### 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{4-2}{2}\right\rfloor+1$  = 2 on each axis; channels stay unchanged.

### Pooling window (1,1)

**Step 1: select the entries.**

[21, 11, 12, 9]

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

21 + 11 + 12 + 9 = 53

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

53/4 = **13.25**. Maximum = **21**

### Pooling window (1,2)

**Step 1: select the entries.**

[15, 10, 10, 11]

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

15 + 10 + 10 + 11 = 46

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

46/4 = **11.5**. Maximum = **15**

### Pooling window (2,1)

**Step 1: select the entries.**

[11, 13, 7, 4]

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

11 + 13 + 7 + 4 = 35

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

35/4 = **8.75**. Maximum = **13**

### Pooling window (2,2)

**Step 1: select the entries.**

[18, 12, 15, 12]

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

18 + 12 + 15 + 12 = 57

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

57/4 = **14.25**. Maximum = **18**

**Average output:**   $\begin{bmatrix}13.25 & 11.5\\8.75 & 14.25\end{bmatrix}$ . **Max output:**   $\begin{bmatrix}21 & 15\\13 & 18\end{bmatrix}$ . Pooling normally has zero trainable parameters and reduces spatial dimensions.
