ttnn.untilize_with_unpadding
- ttnn.untilize_with_unpadding(input_tensor: ttnn.Tensor, output_tensor_end: shape, *, memory_config: ttnn.MemoryConfig = None, use_multicore: bool = True, sub_core_grids: ttnn.CoreRangeSet = None) ttnn.Tensor
-
Changes data layout of input tensor to ROW_MAJOR and unpads/removes elements from the tensor.
Input tensor must be on TT accelerator device, in TILE layout, and may have BFLOAT16, FLOAT32, BFLOAT8_B, INT32, or UINT32 data type.
Output tensor will be on TT accelerator device, in ROW_MAJOR layout, and will have the same data type as the input (BFLOAT8_B inputs are converted to BFLOAT16 on output).
- Parameters:
-
input_tensor (ttnn.Tensor)the input tensor
output_tensor_end (shape)End indices of input tensor in output tensor.
- Keyword Arguments:
-
memory_config (ttnn.MemoryConfig, optional)Memory configuration for the operation. Defaults to None.
use_multicore (bool, optional)Whether to use multicore. Defaults to True.
sub_core_grids (ttnn.CoreRangeSet, optional)Sub core grids. Defaults to None.
- Returns:
-
ttnn.Tensorthe output tensor.
Example
# Create a tilized tensor with padding tilized_tensor = ttnn.rand((1, 1, 64, 64), dtype=ttnn.bfloat16, layout=ttnn.Layout.TILE, device=device) # Untilize the tensor with unpadding untilized_tensor = ttnn.untilize_with_unpadding(tilized_tensor, output_tensor_end=(1, 1, 64, 32)) logger.info("Untilized Tensor with Unpadding Shape:", untilized_tensor.shape)