piEsposito / blitz-bayesian-deep-learning

A simple and extensible library to create Bayesian Neural Network layers on PyTorch.
GNU General Public License v3.0
918 stars 107 forks source link

when bias=False the zero bias tensor is not moved to gpu #109

Closed Lkruitwagen closed 2 years ago

Lkruitwagen commented 2 years ago

When the bias=False the bias tensor being created in the forward pass and it isn't moved to the gpu.

https://github.com/piEsposito/blitz-bayesian-deep-learning/blob/c70833e59f53dc21220e4e661b59d9923fc2b93b/blitz/modules/linear_bayesian_layer.py#L87

piEsposito commented 2 years ago

You are right, thanks. Do you want to submit a PR and fix it?

Otherwise I can do it myself.

Pi Esposito | piesposito.github.io http://piesposito.github.io

Em qua., 6 de abr. de 2022 às 12:39, Lucas Kruitwagen < @.***> escreveu:

When the bias=False the bias tensor being created in the forward pass and it isn't moved to the gpu.

https://github.com/piEsposito/blitz-bayesian-deep-learning/blob/c70833e59f53dc21220e4e661b59d9923fc2b93b/blitz/modules/linear_bayesian_layer.py#L87

— Reply to this email directly, view it on GitHub https://github.com/piEsposito/blitz-bayesian-deep-learning/issues/109, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALLYRXQEJ2Y3TNCUGNSCMUDVDWV4HANCNFSM5SWOTDIA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

Lkruitwagen commented 2 years ago

Yeah sure! Can do. What do you reckon, something just like:

b = torch.zeros((self.out_features), device=x.device)

?

piEsposito commented 2 years ago

yes, something like that or b = torch.zeros((self.out_features), device=self.device)