Issue
I believe error is because I have an LSTM layer. How can I modify the code so it will work fine? Any help?
Solution
Move the LSTM
layer out of the Sequential layer.
LSTM returns a tuple of output, (hn, cn)
where hn, cn
are the last hidden states.
For example your init function will contain something like
class module(nn.Module):
def __init__(self):
super(nn.Module, self).__init__()
self.lstm = nn.LSTM(...)
self.seq = nn.Sequential(...)
and your forward function will be
def forward(self, x):
lstm_out= self.lstm(x)
out = self.seq(lstm_out[0])
return out
Answered By - Tamir
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.