cuda.tile.sqrt#
- cuda.tile.sqrt(x, /, *, rounding_mode=None, flush_to_zero=False)#
Perform sqrt on a tile.
- Parameters:
x (Tile)
rounding_mode (RoundingMode) – The rounding mode for the operation, only supported for float types, default is RoundingMode.RN when applicable.
flush_to_zero (const bool) – If True, flushes subnormal inputs and results to sign-preserving zero, default is False.
- Return type:
Examples
tx = ct.full((4,), 4.0, dtype=ct.float32) print(f"{ct.sqrt(tx):.1f}")
import cuda.tile as ct import torch @ct.kernel def kernel(): tx = ct.full((4,), 4.0, dtype=ct.float32) print(f"{ct.sqrt(tx):.1f}") torch.cuda.init() ct.launch(torch.cuda.current_stream(), (1,), kernel, ()) torch.cuda.synchronize()
Output
[2.0, 2.0, 2.0, 2.0]