latest (dev)
Copy
Latest development documentation · Updated 2026-10-08
tensorplay.nested.nested_tensor
- tensorplay.nested.nested_tensor(ts, *, dtype=None, device=None, requires_grad=False, layout=None, pin_memory=False)[source]
Constructs a nested tensor from a list / tuple of tensors.
Constituents must share the same rank; they are always copied into one packed buffer sized to the total element count.
- Parameters:
ts (List[Tensor] or Tuple[Tensor]) – tensors of the same rank.
- Keyword Arguments:
dtype (tensorplay.dtype, optional) – desired dtype of the result.
device (tensorplay.device, optional) – desired device of the result.
requires_grad (bool, optional) – whether the result tracks gradients.
layout – only the strided layout (
Noneor0) is supported.pin_memory (bool, optional) – whether the packed buffer is pinned.
- Returns:
the nested tensor.
- Return type:
Help improve this page
Found an error, an unclear step, or a missing example?
Was this page helpful?

