check_grads
Builtin index · REPL & diagnostics
result = check_grads(f, x, [step=], [tol=])
Input: f, x, step, tol · Output: result
What it is
Verifies the analytic reverse-mode gradient of scalar-valued f at x against central finite differences of f itself — an independent route to the same number, which is the point: a wrong backward rule would corrupt both an analytic and a tape-derived check together.
Overloads
One call shape — this function is not overloaded.
| Code | Input | Output | Description |
result = check_grads(f, x, [step=], [tol=]) | f scalar or numberVerifies the analytic reverse-mode gradient of scalar-valued f at x against central finite differences of f itself — an independent route to the same number, which is the point: a wrong backward rule would corrupt both an analytic and a tape-derived check together.x scalar or numberVerifies the analytic reverse-mode gradient of scalar-valued f at x against central finite differences of f itself — an independent route to the same number, which is the point: a wrong backward rule would corrupt both an analytic and a tape-derived check together.step optionalstep= sets the relative difference step, default 1e-6.tol vector, optionalReturns a record with max_error (largest absolute difference), rel_error (that difference relative to the larger gradient magnitude, so it stays meaningful for large gradients), ok (whether rel_error is within tol=, default 1e-6), and the analytic and numeric gradient vectors. | max_error —largest absolute differencerel_error —that difference relative to the larger gradient magnitude, so it stays meaningful for large gradientsok —whether rel_error is within tol=, default 1e-6 | Returns a record with max_error (largest absolute difference), rel_error (that difference relative to the larger gradient magnitude, so it stays meaningful for large gradients), ok (whether rel_error is within tol=, default 1e-6), and the analytic and numeric gradient vectors. step= sets the relative difference step, default 1e-6. Added in v0.3.0 |
Examples
No documentation example calls this form yet. The REPL & diagnostics chapter is where one belongs.