ttnn.tril

ttnn.tril = FastOperation(python_fully_qualified_name='ttnn.tril', function=<ttnn._ttnn.operations.unary.tril_t object>, preprocess_golden_function_inputs=<function default_preprocess_golden_function_inputs>, golden_function=<function register_ttnn_cpp_unary_function.<locals>._golden_function>, postprocess_golden_function_outputs=<function default_postprocess_golden_function_outputs>, is_cpp_operation=True, is_experimental=False)

Returns the lower triangular part of input_tensor by zeroing out elements above the specified diagonal. Elements on and below the given diagonal are preserved, while elements above it are set to zero.

  • diagonal = 0 selects the main diagonal (keeps elements on and below the main diagonal)

  • diagonal > 0 selects a diagonal above the main diagonal (keeps more elements)

  • diagonal < 0 selects a diagonal below the main diagonal (keeps fewer elements)

\[\mathrm{{output\_tensor}}_i = \verb|tril|(\mathrm{{input\_tensor}}_i, \mathrm{diagonal})\]
Parameters:

input_tensor (ttnn.Tensor) – the input tensor.

Keyword Arguments:
  • diagonal (int, optional) – diagonal value. Defaults to 0.

  • memory_config (ttnn.MemoryConfig, optional) – memory configuration for the operation. Defaults to None.

Returns:

ttnn.Tensor – the output tensor.

Note

Supported dtypes and layouts:

Dtypes

Layouts

FLOAT32, BFLOAT16, BFLOAT8_B

TILE, ROW_MAJOR