# tensorplay.nested.nested_tensor Source: https://www.tensorplay.cn/docs/generated/tensorplay.nested.nested_tensor.html ```python tensorplay.nested.nested_tensor(ts, *, dtype=None, device=None, requires_grad=False, layout=None, pin_memory=False) ``` 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](/docs/generated/tensorplay.Tensor.html#tensorplay.Tensor)] or Tuple[[Tensor](/docs/generated/tensorplay.Tensor.html#tensorplay.Tensor)]) – tensors of the same rank. Keyword Arguments: - dtype ([tensorplay.dtype](/docs/generated/tensorplay.DType.html#tensorplay.DType), optional) – desired dtype of the result. - device ([tensorplay.device](/docs/generated/tensorplay.Device.html#tensorplay.Device), optional) – desired device of the result. - requires_grad ([bool](https://docs.python.org/3/builtins/functions.html#bool), optional) – whether the result tracks gradients. - layout – only the strided layout (None or 0) is supported. - pin_memory ([bool](https://docs.python.org/3/builtins/functions.html#bool), optional) – whether the packed buffer is pinned. Returns: the nested tensor. Return type: [Tensor](/docs/generated/tensorplay.Tensor.html#tensorplay.Tensor)