cuda.tile.astype#
- cuda.tile.astype(x, dtype, /)#
Converts a tile to the specified data type.
Examples
tx = ct.arange(4, dtype=ct.int32) ty = ct.astype(tx, ct.float32) print(f"{ty:.1f}")
import cuda.tile as ct import torch @ct.kernel def kernel(): tx = ct.arange(4, dtype=ct.int32) ty = ct.astype(tx, ct.float32) print(f"{ty:.1f}") torch.cuda.init() ct.launch(torch.cuda.current_stream(), (1,), kernel, ()) torch.cuda.synchronize()
Output
[0.0, 1.0, 2.0, 3.0]