Learn R Programming

torch (version 0.0.2)

torch_logical_and: Logical_and

Description

Logical_and

Arguments

input

(Tensor) the input tensor.

other

(Tensor) the tensor to compute AND with

out

(Tensor, optional) the output tensor.

logical_and(input, other, out=None) -> Tensor

Computes the element-wise logical AND of the given input tensors. Zeros are treated as False and nonzeros are treated as True.

Examples

Run this code
# NOT RUN {
if (torch_is_installed()) {

torch_logical_and(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_and(a, b)
# }
# NOT RUN {
torch_logical_and(a, b, out=torch_empty(4, dtype=torch_bool()))
# }
# NOT RUN {
}
# }

Run the code above in your browser using DataLab