latest (dev)
Copy
Latest development documentation · Updated 2026-10-08
tensorplay.nested.to_padded_tensor
- tensorplay.nested.to_padded_tensor(input, padding, output_size=None)[source]
Pads a nested tensor into a regular dense tensor and returns it.
The leading entries of each output slice carry the nested data while the trailing entries are filled with
padding. Padding always copies the underlying data, since the nested and dense representations differ in memory layout.- Parameters:
- Keyword Arguments:
output_size (Tuple[int], optional) – the size of the output. If given, it must be large enough to contain all nested data; otherwise the maximum extent of the constituents along each dimension is inferred.
- Returns:
the dense padded tensor.
- Return type:
Help improve this page
Found an error, an unclear step, or a missing example?
Was this page helpful?

