Returns the lower triangular part of the matrix (2-D tensor) x, the other elements of the result tensor out are set to 0. The lower triangular part of the matrix is defined as the elements on and below the diagonal.
tch_tril(x, diagonal = 0)
x | tensor object |
---|---|
diagonal | integer. the diagonal to consider |
The argument diagonal controls which diagonal to consider. If diagonal = 0, all elements on and below the main diagonal are retained. A positive value includes just as many diagonals above the main diagonal, and similarly a negative value excludes just as many diagonals below the main diagonal.
#> tensor #> 1 0 0 0 0 #> 2 6 0 0 0 #> 3 7 11 0 0 #> 4 8 12 16 0 #> [ Variable[CPUIntType]{4,5} ]#> tensor #> 1 5 0 0 0 #> 2 6 10 0 0 #> 3 7 11 15 0 #> 4 8 12 16 20 #> [ Variable[CPUIntType]{4,5} ]#> tensor #> 1 5 9 0 0 #> 2 6 10 14 0 #> 3 7 11 15 19 #> 4 8 12 16 20 #> [ Variable[CPUIntType]{4,5} ]#> tensor #> 0 0 0 0 0 #> 2 0 0 0 0 #> 3 7 0 0 0 #> 4 8 12 0 0 #> [ Variable[CPUIntType]{4,5} ]#> tensor #> 0 0 0 0 0 #> 0 0 0 0 0 #> 3 0 0 0 0 #> 4 8 0 0 0 #> [ Variable[CPUIntType]{4,5} ]