xuanqing94 / BayesianDefense

Adv-BNN: Improved Adversarial Defense through Robust Bayesian Neural Network
MIT License
61 stars 12 forks source link

Forward method in vgg_vi.py #7

Closed Harry24k closed 5 years ago

Harry24k commented 5 years ago

In the code "BayesianDefense/models/vgg_vi.py",

def forward(self, x):
    kl_sum = 0
    out = x
    for l in self.features:
        if type(l).__name__.startswith("Rand"):
            out, kl = l.forward(out)
            if kl is not None:
                kl_sum += kl
        else:
            out = l.forward(out)
    out = out.view(out.size(0), -1)
    out, kl = self.classifier.forward(out)
    kl_sum += kl
    return out, kl

I guess kl, one of the return values, should be kl_sum. I am looking forward to explanations :)

Thanks, HarryKim

Harry24k commented 5 years ago

https://github.com/xuanqing94/BayesianDefense/issues/5 treats this issue.