torch_tril_indices | R Documentation |
Tril_indices
torch_tril_indices(
row,
col,
offset = 0,
dtype = NULL,
device = NULL,
layout = NULL
)
row |
( |
col |
( |
offset |
( |
dtype |
( |
device |
( |
layout |
( |
Returns the indices of the lower triangular part of a row
-by-
col
matrix in a 2-by-N Tensor, where the first row contains row
coordinates of all indices and the second row contains column coordinates.
Indices are ordered based on rows and then columns.
The lower triangular part of the matrix is defined as the elements on and below the diagonal.
The argument offset
controls which diagonal to consider. If
offset
= 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. The main diagonal are the set of indices
\lbrace (i, i) \rbrace
for i \in [0, \min\{d_{1}, d_{2}\} - 1]
where d_{1}, d_{2}
are the dimensions of the matrix.
When running on CUDA, `row * col` must be less than \eqn{2^{59}} to prevent overflow during calculation.
if (torch_is_installed()) {
## Not run:
a = torch_tril_indices(3, 3)
a
a = torch_tril_indices(4, 3, -1)
a
a = torch_tril_indices(4, 3, 1)
a
## End(Not run)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.