Comments (6)
While the reproducer in the original post works with the fix by @PetroZarytskyi, the underlying issue doesn't seem to really fixed because adding another trivial if
statement after defining the constant breaks Clad again:
double wrapper(double *params)
{
if (true) {
double constant = 11.;
if (true) { // NEW
return foo(params[0], constant, 1.);
} // NEW
}
return 0.0;
}
from clad.
@guitargeek, can you provide us with the values of params
and the expected result of wrapper
?
from clad.
You can just take the code from the initial post in this issue, and replace the wrapper
there with the new one. The reproducer provides the params
values and computes the expected gradient numerically
from clad.
Do we care what foo
does?
from clad.
Mathematically no, the only requirement to trigger the problem is that de definition of foo
is not known to Clad. That's why I put it into a separate shared library in the reproducer
from clad.
Thanks for fixing things up to this point! The current failures with RooFit can be reduced to this function, which can be plugged in to the full reproducer at the beginning of the issue:
double wrapper(double *params)
{
double obs[]{
110,
};
double result = 0.0;
double hist[1] = {50.};
double tmp6[] = {params[0], 1.};
for (int j = 0; j < 1; j++) {
double signalshapes = hist[j];
double background1shapes = hist[j];
double tmp0[] = {signalshapes, background1shapes};
double tmp9 = 0.;
for (int i = 0; i < 2; i++) {
tmp9 += tmp0[i] * tmp6[i];
}
result += std::log(tmp9) - std::lgamma(obs[j] + 1.);
}
return result;
}
It seems to be related to double-loops again
from clad.
Related Issues (20)
- Error in gradients for `if conditions` with declarations
- Move backward incompatible changes for v2.0 HOT 1
- Remove the assert on AppendDelayed
- Custom derivatives are not detected and used correctly when namespaces are present.
- Add custom derivatives for all math and other std:: builtin functions
- Add a target for verifying only `CHECK-EXEC` in tests
- Missing derivative with globals / variables of static storage duration HOT 5
- Non-compilable code output for division operation in reverse mode
- Incorrect gradient computation for non-zeroed derivatives HOT 4
- Regression in support of functions with unknown definition HOT 4
- Incorrect gradient for if-conditions with side-effects
- Non-differentiable attribute not being applied to nested classes
- Add support for differentiating the null (empty) statement `;`
- Two functions HOT 9
- Incorrect type of zero returned in VisitCallExpr HOT 1
- Add support for the logical negation operator in conditions (forward mode)
- Add support for comparison operators with differentiable substatements in for loop conditions (forward mode)
- Incorrect derivative for while-loops with declarations and assignments in forward mode
- Incorrect derivative for if-statements with assignments in forward mode HOT 5
- Trying to differentiate an operator in reverse mode fails. HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from clad.