ttnn.from_device
- ttnn.from_device(tensor: ttnn.Tensor, blocking: bool = True, *, queue_id: ttnn.QueueId = None) ttnn.Tensor
-
Copy tensor from device to host.
- Parameters:
-
tensor (ttnn.Tensor)the tensor to be copied from device to host.
blocking (bool, optional)whether the operation should be blocked until the copy is complete. Defaults to True.
- Keyword Arguments:
-
queue_id (ttnn.QueueId, optional)The queue id to use. Defaults to None.
- Returns:
-
ttnn.Tensorthe host tensor copy.
Example
# Open the device # device_id = 0 # device = ttnn.open_device(device_id=device_id) # Create a TT-NN tensor on the device and move it back to the host ttnn_tensor_on_device = ttnn.rand((2, 3), dtype=ttnn.bfloat16, device=device) ttnn_tensor_on_host = ttnn.from_device(ttnn_tensor_on_device) logger.info(f"TT-NN tensor shape after moving from device to host: {ttnn_tensor_on_host.shape}")