# Understanding seq\_lens

**URL:** <https://discuss.ray.io/t/understanding-seq-lens/8137>\
**Category:** RLlib\
**Created:** [November 4, 2022, 10:31am UTC](https://discuss.ray.io/t/understanding-seq-lens/8137 "2022-11-04T10:31:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sa1g](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/sa1g/32/3388_2.png) [@sa1g](https://discuss.ray.io/u/sa1g)\
**Post date:** [November 4, 2022, 10:31am UTC](https://discuss.ray.io/t/understanding-seq-lens/8137/1 "2022-11-04T10:31:40Z")

</div>

While working with `RecurrentNetwork` I came across `seq_lens` in forward\_rnn.  
Can someone explain what it is, how it’s built and, if possible, what it does? I found nothing in the docs.  
Thank you very much in advance!

---

<div class="post-metadata">

**Author:** ![mannyv](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/mannyv/32/606_2.png) [@mannyv](https://discuss.ray.io/u/mannyv)\
**Post date:** [November 4, 2022, 10:42am UTC](https://discuss.ray.io/t/understanding-seq-lens/8137/2 "2022-11-04T10:42:59Z")

</div>

Hi @sa1g,

Perhaps this thread will help. I have written about this many times so an advanced search of my posts on seq\_len might help as well.

> [@\[rllib\] SampleBatch "state\_in\_0" dimension shorter than expected](https://discuss.ray.io/t/rllib-samplebatch-state-in-0-dimension-shorter-than-expected/2354/4):
>
> What is your max\_seq\_len? Before passing the model into forwad\_rnn two things happen. 1. The data in the sample batch is padded so that all inputs are the same size as your longest episode. So if you had sequences of length [5,12,10,4] they would all be padded with zeros to be 12 steps long. You would end up with a total of12 \* 4 timesteps in your sample batch. They are also shortened to be no larger than max sequence length. Let’s say your max\_seq\_len in the model config was 20. Your state in …
