# C4,W1,A2 E1 BatchNormalization for axis 3

**URL:** <https://community.deeplearning.ai/t/c4-w1-a2-e1-batchnormalization-for-axis-3/235409>\
**Category:** Convolutional Neural Networks\
**Tags:** coursera-platform\
**Created:** [November 27, 2022, 10:30am UTC](https://community.deeplearning.ai/t/c4-w1-a2-e1-batchnormalization-for-axis-3/235409 "2022-11-27T10:30:26Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![rasgulla.c](https://avatars.discourse-cdn.com/v4/letter/r/d9b06d/32.png) [@rasgulla.c](https://community.deeplearning.ai/u/rasgulla.c)\
**Post date:** [November 27, 2022, 10:30am UTC](https://community.deeplearning.ai/t/c4-w1-a2-e1-batchnormalization-for-axis-3/235409/1 "2022-11-27T10:30:26Z")

</div>

in happyModel exercise 1  
BatchNormalization for axis 3  
here axis 3 refer to channel?  
if yes then are we trying to normalize all the channels of input?

---

<div class="post-metadata">

**Author:** ![rmwkwok](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/rmwkwok/32/126977_2.png) [@rmwkwok](https://community.deeplearning.ai/u/rmwkwok)\
**Post date:** [November 27, 2022, 10:40pm UTC](https://community.deeplearning.ai/t/c4-w1-a2-e1-batchnormalization-for-axis-3/235409/2 "2022-11-27T22:40:19Z")

</div>

Hello @rasgulla.c,

Yes! Axis 3 refers to the channel axis. If you have 3 channels by the time it reaches the BatchNorm layer, it means that the BatchNorm layer remembers a mean and a variance for each of the 3 channels. So you are going to normalize all the pixels along the 3 channels respectively.

Cheers,  
Raymond

---

<div class="post-metadata">

**Author:** ![rasgulla.c](https://avatars.discourse-cdn.com/v4/letter/r/d9b06d/32.png) [@rasgulla.c](https://community.deeplearning.ai/u/rasgulla.c)\
**Post date:** [November 29, 2022, 6:04am UTC](https://community.deeplearning.ai/t/c4-w1-a2-e1-batchnormalization-for-axis-3/235409/3 "2022-11-29T06:04:22Z")

</div>

so i’m passing axis = 2  
im not passing the test.

---

<div class="post-metadata">

**Author:** ![rmwkwok](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/rmwkwok/32/126977_2.png) [@rmwkwok](https://community.deeplearning.ai/u/rmwkwok)\
**Post date:** [November 29, 2022, 7:11am UTC](https://community.deeplearning.ai/t/c4-w1-a2-e1-batchnormalization-for-axis-3/235409/4 "2022-11-29T07:11:45Z")

</div>

and why do you use axis = 2?

---

<div class="post-metadata">

**Author:** ![rasgulla.c](https://avatars.discourse-cdn.com/v4/letter/r/d9b06d/32.png) [@rasgulla.c](https://community.deeplearning.ai/u/rasgulla.c)\
**Post date:** [November 29, 2022, 7:28am UTC](https://community.deeplearning.ai/t/c4-w1-a2-e1-batchnormalization-for-axis-3/235409/5 "2022-11-29T07:28:17Z")

</div>

let say input is 32,32,3 then axis = 2 is 3 right???

---

<div class="post-metadata">

**Author:** ![rmwkwok](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/rmwkwok/32/126977_2.png) [@rmwkwok](https://community.deeplearning.ai/u/rmwkwok)\
**Post date:** [November 29, 2022, 7:57am UTC](https://community.deeplearning.ai/t/c4-w1-a2-e1-batchnormalization-for-axis-3/235409/6 "2022-11-29T07:57:57Z")

</div>

The axis 0 is reserved for meaning the number of samples. So your 32, 32, 3 are in axis 1, 2, and 3 respectively.
