cuda.tile.abs#
- cuda.tile.abs(x, /)#
Perform abs on a tile.
Examples
tx = ct.arange(4, dtype=ct.int32) - 2 print("input:", tx) print("abs:", ct.abs(tx))
import cuda.tile as ct import torch @ct.kernel def kernel(): tx = ct.arange(4, dtype=ct.int32) - 2 print("input:", tx) print("abs:", ct.abs(tx)) torch.cuda.init() ct.launch(torch.cuda.current_stream(), (1,), kernel, ()) torch.cuda.synchronize()
Output
input: [-2, -1, 0, 1] abs: [2, 1, 0, 1]