Rate this Page

as_nested_tensor#

class torchrl.envs.llm.transforms.as_nested_tensor(list_of_tensordicts: list[TensorDictBase])[source]#

Stacks a list of tensordicts into a single tensordict with nested tensors.

Parameters:

list_of_tensordicts (list[TensorDictBase]) – A list of tensordicts to stack.

Returns:

A tensordict with nested tensors.

Return type:

TensorDictBase