ttnn.copy_host_to_device_tensor_partial

ttnn.copy_host_to_device_tensor_partial() None

Copies host tensor data into a pre-allocated device tensor, writing only the shards mapped to cores in logical_core_filter.

The device tensor must use a sharded memory layout (height, width, block, or ND sharded). Only shards whose logical core coordinates intersect the filter are written; all other shards remain unchanged on the device.

:param * host_tensor: the ttnn.Tensor on host containing the source data. :param * device_tensor: the ttnn.Tensor already allocated on device with a sharded memory config. :param * logical_core_filter: a ttnn.CoreRangeSet selecting which logical cores’ shards to write. An empty set is a no-op. :param * cq_id: the optional ttnn.QueueId command queue to use. Defaults to None.

Note

  • The device tensor must have a sharded buffer layout (L1 or DRAM sharded).

  • An empty logical_core_filter is a no-op — no data is transferred.

  • Host and device tensors must have the same shape, dtype, and data layout.

Example

>>> dev_tensor = ttnn.allocate_tensor_on_device(shape, ttnn.uint32, ttnn.ROW_MAJOR_LAYOUT, device, sharded_mem_config)
>>> filter = ttnn.CoreRangeSet({ttnn.CoreRange(ttnn.CoreCoord(0, 0), ttnn.CoreCoord(0, 0))})
>>> ttnn.copy_host_to_device_tensor_partial(host_tensor, dev_tensor, filter)