ttnn.reallocate
- ttnn.reallocate(tensor: ttnn.Tensor, memory_config: ttnn.MemoryConfig = None) ttnn.Tensor
-
reallocate(tensor: ttnn._ttnn.tensor.Tensor, memory_config: ttnn._ttnn.tensor.MemoryConfig | None = None) -> ttnn._ttnn.tensor.Tensor
Deallocates device tensor and returns a reallocated tensor.
- Parameters:
-
tensor (ttnn.Tensor) – the input tensor.
memory_config (ttnn.MemoryConfig, optional) – memory configuration for the reallocated tensor. Defaults to None.
- Returns:
-
ttnn.Tensor – the reallocated tensor.
Example
# Create a TT-NN tensor, deallocate it, and then reallocate it ttnn_tensor = ttnn.rand((2, 3), dtype=ttnn.bfloat16, device=device) ttnn_tensor_reallocated = ttnn.reallocate(ttnn_tensor) logger.info("Reallocated TT-NN tensor shape", ttnn_tensor_reallocated.shape)