ttnn.softcap
- ttnn.softcap(input_tensor: ttnn.Tensor, beta: float, *, memory_config: ttnn.MemoryConfig = None, output_tensor: ttnn.Tensor = None, sub_core_grids: ttnn.CoreRangeSet = None) ttnn.Tensor
-
Applies softcap to
input_tensorelement-wise with beta.Bounds the input smoothly to +/-beta: near-linear well inside beta, saturating at the limits. Known as soft capping (e.g. Gemma logit softcapping); also the up half of Moonshot’s SiTU activation.
\[\mathrm{output\_tensor}_i = \verb|beta| \cdot \tanh(\mathrm{input\_tensor}_i / \verb|beta|)\]- Parameters:
-
input_tensor (ttnn.Tensor)the input tensor.
beta (float)The beta parameter. Bounds the output to +/-beta. Must be non-zero.
- 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.
sub_core_grids (ttnn.CoreRangeSet, optional)sub core grids for the operation. Defaults to None.
- Returns:
-
ttnn.Tensorthe output tensor.
Note
Supported dtypes and layouts:
Dtypes
Layouts
BFLOAT16, BFLOAT8_B
TILE, ROW_MAJOR