Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clad crashes when trying to initialise a class type declaration in the reverse mode #1082

Open
gojakuch opened this issue Sep 4, 2024 · 1 comment
Assignees

Comments

@gojakuch
Copy link
Collaborator

gojakuch commented Sep 4, 2024

reproducer:

#include "clad/Differentiator/Differentiator.h"
#include "clad/Differentiator/STLBuiltins.h"
#include <iostream>

double fn(double x, double y) {
    std::vector<double> v{1, 2, 3}; // this doesn't work
    return v[0];
}

int main(int argc, char* argv[]) {
    double dx, dy;
    auto df = clad::gradient(fn, "x, y");
    std::cout << fn(3, 4) << '\n';
    dx = 0; dy = 0;
    df.execute(3, 4, &dx, &dy);
    std::cout << dx << ' ' << dy << '\n';
}

same thing is happening with other types

@gojakuch
Copy link
Collaborator Author

I guess what needs to be done is that we need some support of the initializer_list in the reverse mode and then we just need to make custom pullbacks for constructors that use it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants