ttnn.mish
- ttnn.mish(input_tensor: ttnn.Tensor, *, fast_and_approximate_mode: bool = False, memory_config: ttnn.MemoryConfig = None, output_tensor: ttnn.Tensor = None, sub_core_grids: ttnn.CoreRangeSet = None) ttnn.Tensor
-
Applies mish to
input_tensorelement-wise.\[\mathrm{output\_tensor}_i = mish(\mathrm{input\_tensor}_i)\]- Parameters:
-
input_tensor (ttnn.Tensor) – the input tensor. [Supported range -20 to inf]
- Keyword Arguments:
-
fast_and_approximate_mode (bool, optional) – Use the fast and approximate mode. Defaults to False.
memory_config (ttnn.MemoryConfig, optional) – Memory configuration for the operation. Defaults to None.
output_tensor (ttnn.Tensor, optional) – preallocated output tensor. Defaults to None.
sub_core_grids (ttnn.CoreRangeSet, optional) – sub core grids for the operation. Defaults to None.
- Returns:
-
ttnn.Tensor – the output tensor.
Note
Supported dtypes and layouts:
Dtypes
Layouts
BFLOAT16, BFLOAT8_B, FLOAT32
TILE, ROW_MAJOR
Example
# Create a tensor with random values tensor = ttnn.rand([2, 2], dtype=ttnn.bfloat16, layout=ttnn.TILE_LAYOUT, device=device) # Compute Mish activation function output = ttnn.mish(tensor) logger.info(f"Mish: {output}")