torch_eye {torch} | R Documentation |
Eye
Description
Eye
Usage
torch_eye(
n,
m = n,
dtype = NULL,
layout = NULL,
device = NULL,
requires_grad = FALSE
)
Arguments
n |
(int) the number of rows |
m |
(int, optional) the number of columns with default being |
dtype |
( |
layout |
( |
device |
( |
requires_grad |
(bool, optional) If autograd should record operations on the returned tensor. Default: |
eye(n, m=NULL, out=NULL, dtype=NULL, layout=torch.strided, device=NULL, requires_grad=False) -> Tensor
Returns a 2-D tensor with ones on the diagonal and zeros elsewhere.
Examples
if (torch_is_installed()) {
torch_eye(3)
}