torch_logical_and: Logical_and

Description Usage Arguments logical_and(input, other, out=NULL) -> Tensor Examples

View source: R/gen-namespace.R

Description

Logical_and

Usage

1
torch_logical_and(self, other)

Arguments

self

(Tensor) the input tensor.

other

(Tensor) the tensor to compute AND with

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

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
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()))

## End(Not run)
}

torch documentation built on Oct. 7, 2021, 9:22 a.m.