warp.tile_assign#
- warp.tile_assign( ) None#
Copy a tile into a subrange of a destination tile.
dstis modified in place and requires shared storage.When
srcanddsthave different element types, each element is converted following C++ conversion rules. Overlapping source and destination regions assign like NumPy;t[1:] = t[:-1]shifts the tile.In a backward pass, gradients from the overwritten region of
dstare accumulated into the adjoint ofsrc, then cleared from that region ofdst.- Parameters:
dst – Destination tile, modified in place. Must have the same number of dimensions as
src.src – Source tile. Must fit inside
dstatoffsetalong every axis.offset – Coordinate in
dstat which to writesrc. If omitted,srcis written at the origin. Must have one entry per dimension ofdstand may contain runtime values.
Example
@wp.kernel def insert_values(a: wp.array[float], out: wp.array[float]): dst = wp.tile_full(shape=6, value=-1.0, dtype=float) src = wp.tile_load(a, shape=3) wp.tile_assign(dst, src, offset=(2,)) wp.tile_store(out, dst) a = wp.array([1.0, 2.0, 3.0], dtype=float) out = wp.zeros(6, dtype=float) wp.launch_tiled(insert_values, dim=1, inputs=[a], outputs=[out], block_dim=4) print(out.numpy())
[-1. -1. 1. 2. 3. -1.]