all.torch.Tensor: all

Description Usage Arguments Value Examples

Description

Returns True if all elements in the tensor are non-zero, False otherwise.

Usage

1
2
## S3 method for class 'torch.Tensor'
all(x, dim, ...)

Arguments

x

tensor

dim

dimension to reduce

...

other parameters (yet to be developed)

Value

A tensor of type torch.uint8 representing the boolean result: 1 for TRUE and 0 for FALSE.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
## Not run: 
a <- torch$BoolTensor(list(TRUE, TRUE, TRUE, TRUE))
b <- torch$BoolTensor(list(FALSE, TRUE, TRUE, TRUE))
c <- torch$BoolTensor(list(TRUE, TRUE, TRUE, FALSE))
all(a)
all(b)
all(c)
d <- torch$tensor(list(list(0, 0),
                       list(0, 0),
                       list(0, 1),
                       list(1, 1)), dtype=torch$uint8)
all(d)
all(d, dim=0L)
all(d, dim=1L)

## End(Not run)

rTorch documentation built on Jan. 13, 2021, 4:32 p.m.