# Is it possible to implement custom rnn without using rllib provided api?

**URL:** <https://discuss.ray.io/t/is-it-possible-to-implement-custom-rnn-without-using-rllib-provided-api/7639>\
**Category:** RLlib\
**Created:** [September 22, 2022, 4:24pm UTC](https://discuss.ray.io/t/is-it-possible-to-implement-custom-rnn-without-using-rllib-provided-api/7639 "2022-09-22T16:24:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kittiwin-Kumlungmak](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/kittiwin-kumlungmak/32/3162_2.png) [@Kittiwin-Kumlungmak](https://discuss.ray.io/u/Kittiwin-Kumlungmak)\
**Post date:** [September 22, 2022, 4:24pm UTC](https://discuss.ray.io/t/is-it-possible-to-implement-custom-rnn-without-using-rllib-provided-api/7639/1 "2022-09-22T16:24:05Z")

</div>

- High: It blocks me to complete my task.

Hello, I’m trying to implement a custom RNN with TF. I’m curious if I need to follow the [example](https://github.com/ray-project/ray/blob/master/rllib/examples/models/rnn_model.py) provided.

In my case, the env provides the observation of shape [timesteps, features]. Thus, the historical data is already provided for the rnn network. Can I just implement forward() without forward\_rnn().

---

<div class="post-metadata">

**Author:** ![gjoliver](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/gjoliver/32/1490_2.png) [@gjoliver](https://discuss.ray.io/u/gjoliver)\
**Post date:** [October 5, 2022, 12:43am UTC](https://discuss.ray.io/t/is-it-possible-to-implement-custom-rnn-without-using-rllib-provided-api/7639/2 "2022-10-05T00:43:32Z")

</div>

Definitely.  
you can implement your own RNN model by simply extending TFModelV2 instead of RecurrentNetwork (which is just a util class to make normal RNN modeling easier).  
then you only have to implement forward().
