From f3794ba121d3b5dd43acad8894ce0d6cd9c69ba6 Mon Sep 17 00:00:00 2001 From: Vincent Moens Date: Wed, 29 Jan 2025 19:09:17 -0800 Subject: [PATCH] [BugFix] densify non tensor stack is a no-op ghstack-source-id: edbc22ce562cd918ce5dd5c0441e47cdadf7d88a Pull Request resolved: https://github.com/pytorch/tensordict/pull/1194 --- tensordict/tensorclass.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tensordict/tensorclass.py b/tensordict/tensorclass.py index 0f4e43988..8a6f5cb3f 100644 --- a/tensordict/tensorclass.py +++ b/tensordict/tensorclass.py @@ -3562,6 +3562,10 @@ def _from_list(cls, datalist: List, device: torch.device, ndim: int | None = Non stack_dim=0, ) + def densify(self, layout: torch.layout = torch.strided): + # No need to do anything with a non tensor stack + return self + def update( self, input_dict_or_td: dict[str, CompatibleType] | T,