You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Compile with clang++ -std=c++20 -fplugin=/usr/lib/clad.so missing_warning.cxx -o missing_warning
#include"clad/Differentiator/Differentiator.h"
#include<cmath>inlinedoubleinnerWrapper(double x)
{
returnstd::lgamma(x); // call any function that needs num. diff.
}
doublewrapper(double *params)
{
// When calling the num-diffed function directly, you get the correct// warning:// return std::lgamma(params[0]);returninnerWrapper(params[0]);
}
intmain()
{
auto grad = clad::gradient(wrapper, "params");
}
When calling std::lgamma directly, you get this correct warning when compiling:
warning: Falling back to numerical differentiation for 'lgamma' since no suitable overload was found and clad could not derive it. To disable this feature, compile your programs with -DCLAD_NO_NUM_DIFF.
1 warning generated.
However, the warning is absent in the reproducer with the nested function call.
It would be nice if you also get the warning in that situation, because these warnings are very useful to spot residual num. diffs in the gradients.
The text was updated successfully, but these errors were encountered:
guitargeek
changed the title
Missing num-diff fallback warnings in nested funciton calls
Missing num-diff fallback warnings in nested function calls
Dec 13, 2023
Reproducer:
When calling
std::lgamma
directly, you get this correct warning when compiling:However, the warning is absent in the reproducer with the nested function call.
It would be nice if you also get the warning in that situation, because these warnings are very useful to spot residual num. diffs in the gradients.
The text was updated successfully, but these errors were encountered: