aesara.tensor.triu_indices_from

aesara.tensor.triu_indices_from#

aesara.tensor.triu_indices_from(a: ndarray | TensorVariable, k: int | ScalarVariable = 0) Tuple[TensorVariable, TensorVariable][source]#

Return the indices for the upper-triangle of arr.

Parameters:
  • arr ({array_like, TensorVariable}, shape(N, N)) – The indices will be valid for square arrays.

  • k (integer scalar, optional) – Diagonal offset to use when forming the indices. k = 0 (the default) is the main diagonal, k < 0 is below it and k > 0 is above.

Returns:

triu_indices_from – Indices for the upper-triangle of arr.

Return type:

tuple, shape(2) of TensorVariable, shape(N)

Raises:

ValueError – If the input is not a 2d array.