kumar-shridhar / PyTorch-BayesianCNN

Bayesian Convolutional Neural Network with Variational Inference based on Bayes by Backprop in PyTorch.
MIT License
1.43k stars 325 forks source link

No " Applying two sequential convolutional operations" #16

Closed lenz3000 closed 5 years ago

lenz3000 commented 5 years ago

Hi, I was just looking at your paper and code. And I don't see any sign of applying the convolutional operation two times, only once here: https://github.com/kumar-shridhar/PyTorch-BayesianCNN/blob/d73da93fde64fa93e933f88c90cce54a4d618589/Image%20Recognition/utils/BBBlayers.py#L48

It seems like you did that in earlier versions of your code as in this commented out bit in BBBLayers_.py :

        # conv_qw_mean = F.conv2d(input=input, weight=weight, stride=self.stride, padding=self.padding,
        #                              dilation=self.dilation, groups=self.groups)
        # conv_qw_std = torch.sqrt(1e-8 + F.conv2d(input=input.pow(2), weight=torch.exp(self.log_alpha)*weight.pow(2),
        #                                          stride=self.stride, padding=self.padding, dilation=self.dilation, groups=self.groups)) 

Why is that?

kumar-shridhar commented 5 years ago

Yes, it is applied in the previous code (still there inside utils). However, it takes more time to converge. Hence, another version that is faster and more efficient has been provided that uses just one convolution.

ludwigwinkler commented 5 years ago

See ... that's what I told you :D

TMullerSG commented 5 years ago

is it true you just revert back to the imagewhich is used in

image
kumar-shridhar commented 5 years ago

I would say it is the LRT trick used in the code that works well.