TensorPlay
latest (dev)
Copy
View Markdown

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:
  • input (Tensor) – the nested tensor.

  • padding (float) – the fill value for the trailing entries.

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:

Tensor

On this page

Ask DeepWiki