aquakin.check_finite_gradient#
- aquakin.check_finite_gradient(value, *, what, remedy)[source]#
Raise a friendly
RuntimeErrorifvalueis non-finite.The silent-NaN footgun of differentiating a stiff solve: the gradient comes back
NaN/Infand nothing says why. Call this on a freshly computed gradient/Jacobian to convert that into an actionable error.- Parameters:
value (array-like) – The gradient or Jacobian to check.
what (str) – Short noun for the message (e.g.
"calibration gradient").remedy (str) – The concrete fix to suggest.
- Return type:
None