ttnn.reallocate
- ttnn.reallocate = Operation(python_fully_qualified_name='ttnn.reallocate', function=<built-in method reallocate of PyCapsule object>, preprocess_golden_function_inputs=<function default_preprocess_golden_function_inputs>, golden_function=<function _golden_function>, postprocess_golden_function_outputs=<function default_postprocess_golden_function_outputs>, is_cpp_operation=False, is_experimental=False)
-
ttnn._ttnn.tensor.Tensor, memory_config: Optional[ttnn._ttnn.tensor.MemoryConfig] = 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
>>> device_id = 0 >>> device = ttnn.open_device(device_id=device_id) >>> tensor = ttnn.to_device(ttnn.from_torch(torch.randn((10, 64, 32), dtype=torch.bfloat16)), device) >>> new_tensor = ttnn.reallocate(tensor, memory_config=my_memory_config)
- Type:
-
reallocate(tensor