cuda.tile.divmod#
- cuda.tile.divmod(x, y, /)#
Elementwise
divmod()on two tiles.For integer inputs, returns
(x // y, x % y). For floating-point inputs, not yet implemented.Can also use the builtin operation divmod(x, y).
The shape of x and y will be broadcasted and dtype promoted to common dtype.
- Returns:
Tuple of two tiles (quotient and remainder).
- Return type:
tuple[Tile | int | float | ScalarProtocol, Tile | int | float | ScalarProtocol]
Examples
tx = ct.arange(4, dtype=ct.int32) print(divmod(tx, 3))
import cuda.tile as ct import torch @ct.kernel def kernel(): tx = ct.arange(4, dtype=ct.int32) print(divmod(tx, 3)) torch.cuda.init() ct.launch(torch.cuda.current_stream(), (1,), kernel, ()) torch.cuda.synchronize()
Output
([0, 0, 0, 1], [0, 1, 2, 0])