Skip to content

Commit

Permalink
Merge pull request #27 from srigas/main
Browse files Browse the repository at this point in the history
Changed bias initialization to avoid NaN errors during training
  • Loading branch information
axeloh committed May 19, 2023
2 parents 9135372 + d00c408 commit 566ba8f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def __init__(self, n_features, window_size, dropout, alpha, embed_dim=None, use_
nn.init.xavier_uniform_(self.a.data, gain=1.414)

if self.use_bias:
self.bias = nn.Parameter(torch.empty(n_features, n_features))
self.bias = nn.Parameter(torch.zeros(n_features, n_features))

self.leakyrelu = nn.LeakyReLU(alpha)
self.sigmoid = nn.Sigmoid()
Expand Down Expand Up @@ -158,7 +158,7 @@ def __init__(self, n_features, window_size, dropout, alpha, embed_dim=None, use_
nn.init.xavier_uniform_(self.a.data, gain=1.414)

if self.use_bias:
self.bias = nn.Parameter(torch.empty(window_size, window_size))
self.bias = nn.Parameter(torch.zeros(window_size, window_size))

self.leakyrelu = nn.LeakyReLU(alpha)
self.sigmoid = nn.Sigmoid()
Expand Down

0 comments on commit 566ba8f

Please sign in to comment.