Skip to main content

//clika-runtime/io.clika.runtime/Ops/diagonal

diagonal

[common]
fun diagonal(input: Tensor, offset: Long = 0, dim1: Long = 0, dim2: Long = 1): Tensor

diagonal(input: Tensor, offset: Long = 0L, dim1: Long = 0L, dim2: Long = 1L): the diagonal operator. Extract the offset-th diagonal between dim1 and dim2: the two source dims are removed and a trailing dim of the diagonal's length is appended (rank - 1 total). Copies into fresh storage (deliberately not a view).