Skip to content
fn

isfinite_op

→TensorImplPtr
int isfinite_op(const int & a)

Python wrappers

Public Python APIs implemented by this engine symbol.

Element-wise test for finite values — returns a boolean tensor that is True at every position whose input is neither NaN nor ±∞\pm\infty.

Not differentiable: no autograd node is wired and the result is always detached.

Math

yi=¬isnan⁡(xi)∧¬isinf⁡(xi)y_i = \neg \operatorname{isnan}(x_i) \wedge \neg \operatorname{isinf}(x_i)

Shape

Output shape equals input shape (elementwise).

See Also

isnan_op, isinf_op.

Parameters

aTensorImplPtr
Input tensor of any floating-point dtype. Integer inputs always produce True since every integer value is finite.

Returns

TensorImplPtr

Boolean tensor with the same shape and device as a; dtype is Dtype::Bool.

Notes

Equivalent to ~(isnan(a) | isinf(a)) but dispatched as a single backend kernel for efficiency.