Skip to content
fn

isinf_op

→TensorImplPtr
int isinf_op(const int & a)

Python wrappers

Public Python APIs implemented by this engine symbol.

Element-wise test for ±∞\pm\infty — returns a boolean tensor that is True at every position whose input is positive or negative infinity.

Not differentiable: this op does not register an autograd node, so the returned tensor is detached even if a has requires_grad=True.

Math

\text{False} & \text{otherwise} \end{cases}$$ **Shape** Output shape equals input shape (elementwise). **See Also** `isnan_op`, `isfinite_op`, `nan_to_num_op`.

Parameters

aTensorImplPtr
Input tensor of any floating-point dtype. Integer dtypes always produce False at every position (no value can represent infinity).

Returns

TensorImplPtr

Boolean tensor with the same shape and device as a. Dtype is Dtype::Bool regardless of a->dtype().

Notes

CPU dispatch uses Accelerate's vector isinf primitive; GPU dispatch uses MLX's isinf. NaN inputs yield False (NaN is neither finite nor infinite).