ttnn.to_device
- ttnn.to_device(*args, ***kwargs)
-
Overloaded function.
to_device(tensor: ttnn._ttnn.tensor.Tensor, device: ttnn._ttnn.device.IDevice, memory_config: Optional[ttnn._ttnn.tensor.MemoryConfig] = None, cq_id: ttnn._ttnn.types.QueueId = QueueId(0)) -> ttnn._ttnn.tensor.Tensor
-
to_device(tensor: ttnn._ttnn.tensor.Tensor, device: ttnn._ttnn.multi_device.MeshDevice, memory_config: Optional[ttnn._ttnn.tensor.MemoryConfig] = None, cq_id: ttnn._ttnn.types.QueueId = QueueId(0)) -> ttnn._ttnn.tensor.Tensor
Copy tensor from host to device.
- Args:
-
tensor (ttnn.Tensor): The tensor to be copied from host to device. device (ttnn.Device | ttnn.MeshDevice): The target device where the tensor will be copied. memory_config (ttnn.MemoryConfig, optional): The memory configuration to use. Defaults to None. cq_id (int, optional): The command queue ID to use. Defaults to 0.
- Returns:
-
ttnn.Tensor: The device tensor copy.
- Example:
-
>>> device_id = 0 >>> device = ttnn.open_device(device_id=device_id) >>> tensor = ttnn.from_torch(torch.randn((10, 64, 32), dtype=torch.bfloat16)) >>> device_tensor = ttnn.to_device(tensor=tensor, device=device)