---
title: "ClikaRT::ops::tril"
sidebar_label: "tril"
description: "Zero out the entries ABOVE the chosen diagonal of the last two axes; the lower-triangular part survives. diagonal: 0 = main, +k above, -k below. Copies."
---

<!-- Generated by tools/doxygen2mdx from Doxygen XML. Do not edit. -->

<span class="api-kind api-kind--function">function</span>

## tril() {#tril}

<div class="api-signature">

[`Tensor`](../Tensor.md) **`tril`**([`Tensor`](../Tensor.md) `input`, `int64_t` `diagonal` `=` `0`)

</div>

Zero out the entries ABOVE the chosen diagonal of the last two axes; the lower-triangular part survives. [`diagonal`](./diagonal.md#diagonal): 0 = main, +k above, -k below. Copies.

**Throws**

- `ClikaRT::Error`: (`INVALID_ARGUMENT`) when the input's rank is \< 2 (`code_name()` carries the reason).

**Returns:** a new tensor, `input`'s shape and dtype.

<div class="api-declared">

Declared in `ClikaRT/compute/ops.h`, line 3520

</div>
