ttnn.pow

ttnn.pow = Operation(python_fully_qualified_name='ttnn.pow', function=<ttnn._ttnn.operations.binary.pow_t object>, preprocess_golden_function_inputs=<function default_preprocess_golden_function_inputs>, golden_function=<function _golden_function_pow>, postprocess_golden_function_outputs=<function default_postprocess_golden_function_outputs>, is_cpp_operation=True, is_experimental=False)

Perform element-wise pow operation on input_tensor with exponent.

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

  • exponent (float, int, ttnn.Tensor) – the exponent value.

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.

  • queue_id (int, optional) – command queue id. Defaults to 0.

Returns:

ttnn.Tensor – the output tensor.

Note

Supported dtypes, layouts, and ranks:

Dtypes

Layouts

Ranks

BFLOAT16, BFLOAT8_B

TILE

2, 3, 4

When exponent is a Tensor, supported dtypes are: BFLOAT16, FLOAT32. Both input tensors should be of same dtype.

Example

>>> tensor = ttnn.from_torch(torch.tensor([[1, 2], [3, 4]], dtype=torch.bfloat16), layout=ttnn.TILE_LAYOUT, device=device)
>>> exponent = 2
>>> output = ttnn.pow(tensor, exponent)