Skip to content
fn

any_op

→TensorImplPtr
int any_op(const int & a)

Python wrappers

Public Python APIs implemented by this engine symbol.

Full-tensor boolean OR-reduction — returns a scalar Bool tensor that is True iff at least one element of a is non-zero (or True for boolean inputs).

Not differentiable: predicate output is detached.

Math

y=⋁i(xi≠0)y = \bigvee_i (x_i \ne 0)

Shape

Output is a 0-D scalar; input may have any shape.

See Also

all_op.

Parameters

aTensorImplPtr
Input tensor of any dtype. Floating-point 0.0 counts as False; NaN counts as True (non-zero).

Returns

TensorImplPtr

Zero-dimensional Dtype::Bool tensor. Shape is {}.

Notes

Reduction is over the flattened tensor; there is no axis argument at this level. Use the Python any(dim=...) wrapper for axis-wise reductions.