Closed zanklanecek closed 3 years ago
The model is constructed in such a way that weights are sampled if it is in training mode, and if in eval mode, mean values are taken as weights themselves, here. Since we wanted to infer from an ensemble, we keep the model in training mode.
Alternatively, you can simply eliminate the ensemble for loop and infer based on mean weights. That should also work fine.
Thank you for explanation 👍
https://github.com/kumar-shridhar/PyTorch-BayesianCNN/blob/d93bad543c3226cd0fe05c0cb0ba033c41b3caa6/main_bayesian.py#L67
Am I missing something or is this specific for Bayesian models? Thanks for your contribution with this code btw, appreciate it.