How to initialize weight for LSTM?

My initialization is showed as following:


But I want to initialize the weights with Xavier not randn. Does someone know how to do it?

Use torch.nn.init.xavier_uniform or torch.nn.init.xavier_normal, whichever one you’re looking for.

1 Like

Thank you very much!