ttnn.empty
- ttnn.empty(shape: List[int], dtype: ttnn.DataType = ttnn.bfloat16, layout: ttnn.Layout = ttnn.ROW_MAJOR, device: ttnn.Device | ttnn.MeshDevice, memory_config: ttnn.MemoryConfig = ttnn.DRAM_MEMORY_CONFIG) ttnn.Tensor
-
Creates a device tensor with uninitialized values of the specified shape, data type, layout, and memory configuration.
- Parameters:
-
shape (List[int]) – The shape of the tensor to be created.
dtype (ttnn.DataType, optional) – The tensor data type. Defaults to ttnn.bfloat16.
layout (ttnn.Layout, optional) – The tensor layout. Defaults to ttnn.ROW_MAJOR.
device (ttnn.Device | ttnn.MeshDevice) – The device where the tensor will be allocated.
memory_config (ttnn.MemoryConfig, optional) – The memory configuration for the operation. Defaults to ttnn.DRAM_MEMORY_CONFIG.
- Returns:
-
ttnn.Tensor – The output uninitialized tensor.
Note
Supported dtypes, layouts, and ranks:
Dtypes
Layouts
Ranks
BFLOAT16, FLOAT32
ROW_MAJOR, TILE
2, 3, 4
BFLOAT_8
TILE
2, 3, 4
Example
# Create an uninitialized TT-NN tensor with the specified shape and data type tensor = ttnn.empty(shape=[2, 3], dtype=ttnn.bfloat16, device=device) logger.info("TT-NN empty tensor shape:", tensor.shape)