From 38993b2bb7251a1c3a76b50c98a3543778639a1b Mon Sep 17 00:00:00 2001 From: Sam Adam-Day Date: Wed, 6 Nov 2024 12:36:23 +0000 Subject: [PATCH] Fix calling pad with immutable sequence --- tensordict/functional.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tensordict/functional.py b/tensordict/functional.py index d5b770e06..a40095141 100644 --- a/tensordict/functional.py +++ b/tensordict/functional.py @@ -74,7 +74,7 @@ def pad(tensordict: T, pad_size: Sequence[int], value: float = 0.0) -> T: for i in range(len(pad_size)): new_batch_size[i // 2] += pad_size[i] - reverse_pad = pad_size[::-1] + reverse_pad = list(pad_size[::-1]) for i in range(0, len(reverse_pad), 2): reverse_pad[i], reverse_pad[i + 1] = reverse_pad[i + 1], reverse_pad[i]