fix #1698 - Add a way to specify non-differentiability of pre-existing functions in forward mode#1703
Open
Lucky-Lodhi2004 wants to merge 5 commits intovgvassilev:masterfrom
Open
Conversation
| const auto* FTP = dTy->getAs<FunctionProtoType>(); | ||
|
|
||
| for (LookupResult::iterator I = Found.begin(), E = Found.end(); I != E; ++I) { | ||
| FunctionDecl* FD = dyn_cast<FunctionDecl>(I.getDecl()); |
Contributor
There was a problem hiding this comment.
warning: use auto when initializing with a template cast to avoid duplicating the type name [modernize-use-auto]
Suggested change
| FunctionDecl* FD = dyn_cast<FunctionDecl>(I.getDecl()); | |
| auto* FD = dyn_cast<FunctionDecl>(I.getDecl()); |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Contributor
|
clang-tidy review says "All clean, LGTM! 👍" |
1 similar comment
Contributor
|
clang-tidy review says "All clean, LGTM! 👍" |
dae6ee9 to
7f303a9
Compare
Contributor
|
clang-tidy review says "All clean, LGTM! 👍" |
7f303a9 to
3b600b0
Compare
Contributor
|
clang-tidy review says "All clean, LGTM! 👍" |
Collaborator
|
How will we specify the non-differentiability of clad::NonDiff fn_pushforward(...) { ... } |
3b600b0 to
07e681a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds support for void pushforward functions in forward mode. When a pushforward function returns void, it signals that the original function is non-differentiable. Clad will now treat such functions as constant (derivative = 0) while still calling the original function.
Changes include updates in
DiffPlanner.cppandBaseForwardModeVisitorto handle void pushforwards correctly. I have added a new test (ForwardMode/VoidPushforward.C) to verify this behavior.