Hi,
Depending on where you create your hidden state you have few possibilities.
If you have access to the current input, you can do input_tensor.new(1, inputs.size(1), self.hiddenchannel).zero_().
If you don’t, you can use .type_as(input_tensor) at the beginning of your forward function.