cuda.tile.tanh#

cuda.tile.tanh(x, /, *, rounding_mode=None)#

Perform tanh on a tile.

Parameters:
  • x (Tile)

  • rounding_mode (RoundingMode) –

    Supported values:

    • RoundingMode.FULL (f32 only)

    • RoundingMode.APPROX (f32 only)

    (since CTK 13.2)

Return type:

Tile

Examples

tx = ct.full((4,), 0.0, dtype=ct.float32)
print(f"{ct.tanh(tx):.1f}")
import cuda.tile as ct
import torch

@ct.kernel
def kernel():
    tx = ct.full((4,), 0.0, dtype=ct.float32)
    print(f"{ct.tanh(tx):.1f}")


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

Output

[0.0, 0.0, 0.0, 0.0]