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

Same variable redefinition in gradient when different loops have the same counter variable name #679

Open
parth-07 opened this issue Dec 9, 2023 · 2 comments

Comments

@parth-07
Copy link
Collaborator

parth-07 commented Dec 9, 2023

Gradient function contains variable redefinition error when different loops have the same counter variable name.

Reproducible example:

#include "clad/Differentiator/Differentiator.h"

double fn(double u, double v) {
    double res = 0;
    for (int i = 0; i < 5; ++i) {
      res += i;
    }
    for (int i = 0; i < 5; ++i) {
      res += i;
    }
    return res;
}

int main() {
    auto fn_grad = clad::gradient(fn);
}

_d_i is defined two times in the gradient function fn_grad.

@muskangupta-02
Copy link

muskangupta-02 commented Mar 29, 2024

Hii! I would like to work on this issue. KIndly assign it to me.

@parth-07
Copy link
Collaborator Author

Hi @muskangupta-02, Please feel free to raise a pull-request for this issue.

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

No branches or pull requests

2 participants