ttnn.rpow

ttnn.rpow(input_tensor: ttnn.Tensor, exponent: float, *, memory_config: ttnn.MemoryConfig = None, output_tensor: ttnn.Tensor = None) ttnn.Tensor

Applies rpow to input_tensor element-wise with exponent.

\[\mathrm{output\_tensor}_i = \verb|rpow|(\mathrm{input\_tensor}_i, \verb|exponent|)\]
Parameters:
  • input_tensor (ttnn.Tensor) – the input tensor.

  • exponent (float) – exponent value. Non-positive values are not supported..

Keyword Arguments:
  • memory_config (ttnn.MemoryConfig, optional) – Memory configuration for the operation. Defaults to None.

  • output_tensor (ttnn.Tensor, optional) – preallocated output tensor. Defaults to None.

Returns:

ttnn.Tensor – the output tensor.

Note

Supported dtypes, layouts, and ranks:

Dtypes

Layouts

Ranks

BFLOAT16

TILE

2, 3, 4

Example

# Create tensor for reverse power operation
tensor = ttnn.from_torch(
    torch.tensor([[1, 2], [3, 4]], dtype=torch.bfloat16),
    dtype=ttnn.bfloat16,
    layout=ttnn.TILE_LAYOUT,
    device=device,
)
exponent = 3

# Compute exponent^tensor for each element
output = ttnn.rpow(tensor, exponent)
logger.info(f"Reverse power (3^tensor) result: {output}")