fn
isreal
→Tensorisreal(x: Tensor)Element-wise test for real-valued entries.
Lucid currently supports only real-valued floating dtypes (and
complex tensors via the dedicated complex64 dtype), so for real
inputs this predicate is uniformly True. Provided for API parity
with reference frameworks that include both real and complex dtypes.
Parameters
xTensorInput tensor.
Returns
TensorBoolean tensor of the same shape as x; every entry is
True for real-valued inputs.
Notes
Mathematical definition (for real dtypes):
For complex inputs (when supported), isreal reports True
only where the imaginary part is exactly zero. The current
implementation returns isfinite | isnan | isinf, which is a
tautology for real dtypes.
Examples
>>> import lucid
>>> x = lucid.tensor([1.0, float('nan'), float('inf')])
>>> lucid.isreal(x)
Tensor([ True, True, True])