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

Allow specifying non-differentiable data members #418

Open
parth-07 opened this issue Mar 28, 2022 · 2 comments
Open

Allow specifying non-differentiable data members #418

parth-07 opened this issue Mar 28, 2022 · 2 comments
Assignees

Comments

@parth-07
Copy link
Collaborator

We have recently added class type support in Clad. Currently, all fields of the class are assumed to be differentiable. Practically, there are many non-differentiable fields in the class. We may not need to create derived statements for the expressions modifying non-differentiable fields, thus if we know which fields are non-differentiable, we can ideally produce more optimal derived function code.

One way to specify non-differentiable fields is by using C++ attributes:

class Tensor {
  [[clad::non_differentiable]]
  std::size_t sz;
  double data[10];
}
@MihailMihov
Copy link
Collaborator

@vgvassilev does this issue actually want any further support for the non-differentiable attribute? maybe I'm missing something, but I think this already works in forward mode and when #916 is merged will work in reverse mode too, so maybe I should make #916 close this too?

@vgvassilev
Copy link
Owner

I think so. Do we have a test that explicitly tests this issue?

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

3 participants