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

Hidden Layer in class BayesianLSTM #92

Closed yongen9696 closed 3 years ago

yongen9696 commented 3 years ago

Hi, I went through the paper original paper, Weight Uncertainty in Neural Networks and searching through the class BayesianLSTM.

I would like to know is there any setting to specify the number of hidden layers?

yongen9696 commented 3 years ago

Okay, I found the solution. According to answer in stackoverflow. According to how PyTorch handle the LSTM layer (by stacking each other), BayesianLSTM can have multiple layers by:

first_layer = BayesianLSTM(input_size, hidden_size)
second_layer = BayesianLSTM(hidden_size, hidden_size)

then connect to a linear layer or other operation.