# Training Stateful LSTM in Pytorch cause runtime error

**URL:** <https://discuss.pytorch.org/t/training-stateful-lstm-in-pytorch-cause-runtime-error/44537>\
**Category:** Uncategorized\
**Created:** [May 6, 2019, 6:08pm UTC](https://discuss.pytorch.org/t/training-stateful-lstm-in-pytorch-cause-runtime-error/44537 "2019-05-06T18:08:05Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![babbage](https://discuss.pytorch.org/letter_avatar_proxy/v4/letter/b/59ef9b/32.png) [@babbage](https://discuss.pytorch.org/u/babbage)\
**Post date:** [May 8, 2019, 8:25am UTC](https://discuss.pytorch.org/t/training-stateful-lstm-in-pytorch-cause-runtime-error/44537/3 "2019-05-08T08:25:03Z")

</div>

It might interest you to know that I’ve been trying to do something similar myself: [Confusion regarding PyTorch LSTMs compared to Keras stateful LSTM](https://discuss.pytorch.org/t/confusion-regarding-pytorch-lstms-compared-to-keras-stateful-lstm/44502)

Although I’m not sure if just wrapping the previous hidden data in a torch.Variable ensures that stateful training works

---

_[View the full topic](https://discuss.pytorch.org/t/training-stateful-lstm-in-pytorch-cause-runtime-error/44537)._
