View source: R/gen-namespace.R
| torch_is_nonzero | R Documentation |
Is_nonzero
torch_is_nonzero(self)
self |
(Tensor) the input tensor. |
Returns TRUE if the input is a single element tensor which is not equal to zero
after type conversions.
i.e. not equal to torch_tensor(c(0)) or torch_tensor(c(0)) or
torch_tensor(c(FALSE)).
Throws a RuntimeError if torch_numel() != 1 (even in case
of sparse tensors).
if (torch_is_installed()) {
torch_is_nonzero(torch_tensor(c(0.)))
torch_is_nonzero(torch_tensor(c(1.5)))
torch_is_nonzero(torch_tensor(c(FALSE)))
torch_is_nonzero(torch_tensor(c(3)))
if (FALSE) {
torch_is_nonzero(torch_tensor(c(1, 3, 5)))
torch_is_nonzero(torch_tensor(c()))
}
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.