Hi, I encountered a similar problem yesterday while working with LSTM, what I did was I replaced

out, (hn,cn) = self.lstm(x,(h0,c0))

with

out, state = self.lstm(x, state)

where the state is the same tuple containing h_0, c_0, this solved the error.