fn
is_anomaly_enabled
→boolis_anomaly_enabled()Return whether autograd anomaly detection is currently enabled.
Query accessor for the global flag that detect_anomaly
and set_detect_anomaly mutate. Useful when conditionally
wrapping additional debug logic, or when asserting state inside
test suites.
Parameters
NoneNo description.
Returns
boolTrue if anomaly detection is currently active; False
otherwise.
Notes
The flag is process-global. In multi-threaded code (Lucid does not currently run multiple Python threads through the autograd engine) the value would be shared across threads — treat it as a debug switch rather than per-call state.
Examples
>>> import lucid
>>> from lucid.autograd import detect_anomaly, is_anomaly_enabled
>>> is_anomaly_enabled()
False
>>> with detect_anomaly():
... is_anomaly_enabled()
True
>>> is_anomaly_enabled()
False