# Implementing Bayesian CNN

**URL:** <https://discuss.pytorch.org/t/implementing-bayesian-cnn/88689>\
**Category:** Uncategorized\
**Created:** [July 10, 2020, 12:37pm UTC](https://discuss.pytorch.org/t/implementing-bayesian-cnn/88689 "2020-07-10T12:37:39Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![MERAH\_Samia](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/merah_samia/32/53909_2.png) [@MERAH\_Samia](https://discuss.pytorch.org/u/MERAH_Samia)\
**Post date:** [July 10, 2020, 12:37pm UTC](https://discuss.pytorch.org/t/implementing-bayesian-cnn/88689/1 "2020-07-10T12:37:39Z")

</div>

Hi everyone,  
I am trying to implement Bayesian CNN, and am searching for people who have worked on this topic, I really need some help (especially tutorials)?  
Thank you,

---

<div class="post-metadata">

**Author:** ![Shisho\_Sama](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/shisho_sama/32/6926_2.png) [@Shisho\_Sama](https://discuss.pytorch.org/u/Shisho_Sama)\
**Post date:** [July 10, 2020, 12:45pm UTC](https://discuss.pytorch.org/t/implementing-bayesian-cnn/88689/2 "2020-07-10T12:45:37Z")

</div>

Hi,  
whats your problem? have you searched the papers in this field?  
there was this repo that I had used a year ago : [https://github.com/kumar-shridhar/PyTorch-BayesianCNN](https://github.com/kumar-shridhar/PyTorch-BayesianCNN)  
give that a try and it should get you going.  
Update :  
strongly recommend you to see : [Implementing a Bayesian CNN in PyTorch](https://discuss.pytorch.org/t/implementing-a-bayesian-cnn-in-pytorch/13547/12)

---

<div class="post-metadata">

**Author:** ![MERAH\_Samia](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/merah_samia/32/53909_2.png) [@MERAH\_Samia](https://discuss.pytorch.org/u/MERAH_Samia)\
**Post date:** [July 12, 2020, 4:15pm UTC](https://discuss.pytorch.org/t/implementing-bayesian-cnn/88689/3 "2020-07-12T16:15:33Z")

</div>

Hi,  
I found it complicated,I am searching for an approach to implement Bayesian Deep learning, i found two methods either by bayes by backprop or by dropout, I’ve read that Optimising any neural network with dropout is equivalent to a form of approximate Bayesian inference and a network trained with dropout already is a Bayesian neural network,  
Could you please confirm these statements if you have any idea ?

---

<div class="post-metadata">

**Author:** ![blessen](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/blessen/32/12390_2.png) [@blessen](https://discuss.pytorch.org/u/blessen)\
**Post date:** [July 13, 2020, 7:18am UTC](https://discuss.pytorch.org/t/implementing-bayesian-cnn/88689/4 "2020-07-13T07:18:01Z")

</div>

> [@MERAH\_Samia](#):
>
> to a form of approximate Bayesian inference and a network trained with dropout already is a Bayesian neural network,

Hi, regarding your two statements -

1. Yes as per Yarin Gal et al [[1506.02142] Dropout as a Bayesian Approximation: Representing Model Uncertainty in Deep Learning](https://arxiv.org/abs/1506.02142), you could interpret training a neural net with dropout as conducting Bayesian inference.
2. A Bayesian neural net is one that has a distribution over it’s parameters. Using dropout allows for the effective weights to appear as if sampled from a weight distribution. If you were to remove the dropout layer, then you’d have point estimates which would no longer correspond to a bayesian network.

---

<div class="post-metadata">

**Author:** ![MERAH\_Samia](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/merah_samia/32/53909_2.png) [@MERAH\_Samia](https://discuss.pytorch.org/u/MERAH_Samia)\
**Post date:** [July 15, 2020, 2:48pm UTC](https://discuss.pytorch.org/t/implementing-bayesian-cnn/88689/5 "2020-07-15T14:48:56Z")

</div>

Yes I see  
Thank you so much

---

<div class="post-metadata">

**Author:** ![MERAH\_Samia](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/merah_samia/32/53909_2.png) [@MERAH\_Samia](https://discuss.pytorch.org/u/MERAH_Samia)\
**Post date:** [July 15, 2020, 1:48pm UTC](https://discuss.pytorch.org/t/implementing-bayesian-cnn/88689/6 "2020-07-15T13:48:07Z")

</div>

Okay, I see  
Thank you so much
