Skip to main content

ClikaRT::ops::triu

function

triu()

Tensor triu(Tensor x, int64_t diagonal = 0)

Zero out the entries BELOW the chosen diagonal of the last two axes; the upper-triangular part survives. 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, x's shape and dtype.

auto causal = ClikaRT::ops::triu(scores_mask, 1); // strict upper part

Declared in ClikaRT/compute/ops.h, line 3448