warp.tile\_squeeze ================== .. currentmodule:: warp._src.lang .. function:: tile_squeeze(t: Tile[Any, tuple[int, ...]], axis: tuple[int, ...] = ...) -> Tile[Any, tuple[int, ...]] .. wp-function-tags:: :kernel: true :python: false :differentiable: true Return a view of a tile with dimensions of length one removed. The view aliases the source tile, so writing through it modifies ``t``. Taking the view requires shared storage, but the view itself is non-owning and allocates no additional storage. :param t: Input tile to squeeze :param axis: Axis or axes to remove, as a compile-time constant. If omitted, all dimensions of ``t`` with extent one are removed. Each specified axis must refer to a dimension of ``t`` with extent one. Negative axes count from the end. :returns: A non-owning tile that aliases ``t`` with all, or the selected, dimensions of length one removed. .. rubric:: Example .. testcode:: @wp.kernel def remove_singleton_dims(a: wp.array3d[float], out: wp.array[float]): t = wp.tile_load(a, shape=(1, 4, 1)) s = wp.tile_squeeze(t) wp.tile_store(out, s) a = wp.array(np.arange(1, 5, dtype=np.float32).reshape(1, 4, 1), dtype=float) out = wp.zeros(4, dtype=float) wp.launch_tiled(remove_singleton_dims, dim=1, inputs=[a], outputs=[out], block_dim=2) print(out.numpy()) .. testoutput:: [1. 2. 3. 4.]