Giter Club home page Giter Club logo

Comments (6)

guitargeek avatar guitargeek commented on July 24, 2024

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.

vgvassilev avatar vgvassilev commented on July 24, 2024

@guitargeek, can you provide us with the values of params and the expected result of wrapper?

from clad.

guitargeek avatar guitargeek commented on July 24, 2024

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.

vgvassilev avatar vgvassilev commented on July 24, 2024

Do we care what foo does?

from clad.

guitargeek avatar guitargeek commented on July 24, 2024

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.

guitargeek avatar guitargeek commented on July 24, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.