Where
where(condition, x, y) -> Tensor
Return a tensor of elements selected from either x
or y
, depending on condition
.
The operation is defined as:
where(condition) -> tuple of LongTensor
torch_where(condition)
is identical to
torch_nonzero(condition, as_tuple=TRUE)
.
Examples
if (torch_is_installed()) {
if (FALSE) { # \dontrun{
x = torch_randn(c(3, 2))
y = torch_ones(c(3, 2))
x
torch_where(x > 0, x, y)
} # }
}