ttnn.to_memory_config
- ttnn.to_memory_config = Operation(python_fully_qualified_name='ttnn.to_memory_config', function=<ttnn._ttnn.operations.core.to_memory_config_t 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=True, is_experimental=False)
-
Converts a tensor to the desired memory configuration. Used for converting tensors to sharded tensors, interleaved tensors, or converting between DRAM and L1 memory.
- Parameters:
-
tensor (ttnn.Tensor) – the input tensor to be converted.
memory_config (ttnn.MemoryConfig) – the desired memory configuration for the tensor.
dtype (ttnn.DataType, optional) – the optional ttnn data type. Defaults to None.
- Returns:
-
ttnn.Tensor – the converted 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) >>> tensor = ttnn.to_memory_config(tensor, memory_config)