
Last chance! 50% off unlimited learning
Sale ends in
Logical_xor
(Tensor) the input tensor.
(Tensor) the tensor to compute XOR with
(Tensor, optional) the output tensor.
Computes the element-wise logical XOR of the given input tensors. Zeros are treated as False
and nonzeros are
treated as True
.
# NOT RUN {
if (torch_is_installed()) {
torch_logical_xor(torch_tensor(c(TRUE, FALSE, TRUE)), torch_tensor(c(TRUE, FALSE, FALSE)))
a = torch_tensor(c(0, 1, 10, 0), dtype=torch_int8())
b = torch_tensor(c(4, 0, 1, 0), dtype=torch_int8())
torch_logical_xor(a, b)
torch_logical_xor(a$to(dtype=torch_double()), b$to(dtype=torch_double()))
torch_logical_xor(a$to(dtype=torch_double()), b)
}
# }
Run the code above in your browser using DataLab