torch_is_nonzero: Is_nonzero

Description Usage Arguments is_nonzero(input) -> (bool) Examples

View source: R/gen-namespace.R

Description

Is_nonzero

Usage

1

Arguments

self

(Tensor) the input tensor.

is_nonzero(input) -> (bool)

Returns TRUE if the input is a single element tensor which is not equal to zero after type conversions. i.e. not equal to torch_tensor(c(0)) or torch_tensor(c(0)) or torch_tensor(c(FALSE)). Throws a RuntimeError if torch_numel() != 1 (even in case of sparse tensors).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11

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