Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit ff8cee2

Browse files
committed
Ver 0.3
1 parent a516d79 commit ff8cee2

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

‎README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,8 @@ import torchbnn
3838
* **convert_model(nonbayes_to_bayes, bayes_to_nonbayes)** is also changed with prior_sigma instead of prior_log_sigma.
3939
* **Modules(BayesLinear, BayesConv2d, BayesBatchNorm2d)** : Base initialization method is changed to the method of Adv-BNN from the original torch method.
4040
* **functional** : **bayesian_kl_loss** is changed similar to ones in **torch.functional**
41-
* **loss** : **BKLLoss** is added based on bayesian_kl_loss similar to ones in **torch.loss**
41+
* **loss** : **BKLLoss** is added based on bayesian_kl_loss similar to ones in **torch.loss**
42+
43+
### Version 0.3
44+
* **bayesian_kl_loss/BKLLoss returns tensor.Tensor([0]) as default**
45+
* In the previous version, bayesian_kl_loss/BKLLoss returns 0 of int type if there is no Bayesian layers. However, considering all torch loss returns tensor and .item() is used to make them to int type, they are changed to return tensor.Tensor([0]) if there is no Bayesian layers.

‎torchbnn/functional.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ def bayesian_kl_loss(model, reduction='mean', last_layer_only=False) :
3333
3434
"""
3535

36-
kl_sum = 0
36+
kl = torch.Tensor([0])
37+
kl_sum = torch.Tensor([0])
3738
n = 0
3839

3940
for m in model.modules() :

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /