# Custom LSTM Model for R2D2

**URL:** <https://discuss.ray.io/t/custom-lstm-model-for-r2d2/4422>\
**Category:** RLlib\
**Created:** [December 12, 2021, 8:27pm UTC](https://discuss.ray.io/t/custom-lstm-model-for-r2d2/4422 "2021-12-12T20:27:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![LukasNothhelfer](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/lukasnothhelfer/32/1062_2.png) [@LukasNothhelfer](https://discuss.ray.io/u/LukasNothhelfer)\
**Post date:** [December 12, 2021, 8:27pm UTC](https://discuss.ray.io/t/custom-lstm-model-for-r2d2/4422/1 "2021-12-12T20:27:49Z")

</div>

Can anyone give me a hint on how to set up a custom network for the R2D2 algorithm that uses an LSTM? In principle I have something like `observation-> linear1-> linear2-> LSTM-> Q values`. The API is poorly documented to the maximum and incomprehensible. Especially since it also looks like I can’t just override `forward_rnn`, but also have to override the get\_q\_values function for some impossible (because undocumented) to guess reason. I’m trying to figure out this mess here but the whole thing is incomprehensible to the max:  
[https://docs.ray.io/en/latest/rllib-models.html#custom-model-apis-on-top-of-default-or-custom-models](https://docs.ray.io/en/latest/rllib-models.html#custom-model-apis-on-top-of-default-or-custom-models)  
Thanks in advance.
