cuda.tile.pow#

cuda.tile.pow(x, y, /)#

Elementwise pow on two tiles.

Can also use builtin operation x ** y.

Parameters:
  • x (Tile) – LHS tile.

  • y (Tile) – RHS tile.

The shape of x and y will be broadcasted and dtype promoted to common dtype.

Return type:

Tile

Examples

tx = ct.full((4,), 2.0, dtype=ct.float32)
ty = ct.arange(4, dtype=ct.float32)
print(f"{tx ** ty:.1f}")
import cuda.tile as ct
import torch

@ct.kernel
def kernel():
    tx = ct.full((4,), 2.0, dtype=ct.float32)
    ty = ct.arange(4, dtype=ct.float32)
    print(f"{tx ** ty:.1f}")


torch.cuda.init()
ct.launch(torch.cuda.current_stream(), (1,), kernel, ())
torch.cuda.synchronize()

Output

[1.0, 2.0, 4.0, 8.0]