# Seq\_len for tuple obs space

**URL:** <https://discuss.ray.io/t/seq-len-for-tuple-obs-space/3732>\
**Category:** RLlib\
**Created:** [October 5, 2021, 8:19pm UTC](https://discuss.ray.io/t/seq-len-for-tuple-obs-space/3732 "2021-10-05T20:19:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aceticia](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/aceticia/32/1506_2.png) [@Aceticia](https://discuss.ray.io/u/Aceticia)\
**Post date:** [October 5, 2021, 8:19pm UTC](https://discuss.ray.io/t/seq-len-for-tuple-obs-space/3732/1 "2021-10-05T20:19:45Z")

</div>

I’m working on a custom model that has a tuple obs space of length 5, and this is a recurrent model so I’m following the implementation for recurrent net [here](https://github.com/ray-project/ray/blob/49a57aa4778094c5bd73b5cb26f08214db371e6c/rllib/models/torch/recurrent_net.py#L21). When debugging, I found that the dummy batch created at the beginning has batch 32 but seq\_len was [1,1,1,1,1]. If my understanding of seq\_len is correct, this is probably not correct since 5\*1!=32.

Tracing the error, I found this might be from `compute_actions_from_input_dict` in `torch_policy.py`. In line 297, `seq_lens` was created with:

```auto
np.array([1] * len(input_dict["obs"])) \
                if state_batches else None

```

which I think is supposed to take the batch size, but doesn’t handle tuple obs space and took the length of the tuple instead. In reality, what should happen is probably something like this:

```auto
np.array([1] * len(input_dict["obs"][0])) \
                if state_batches else None

```

Just using index 0 should suffice, since every item of the tuple should be of the same batch size.

Is this the expected behavior? Am I missing anything here?
