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

Rev calls to mem fn #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Rev calls to mem fn #4

wants to merge 1 commit into from

Conversation

parth-07
Copy link
Owner

No description provided.

@parth-07 parth-07 force-pushed the rev-calls-to-mem-fn branch 9 times, most recently from 23b4921 to 7111d1e Compare March 18, 2022 20:03
@parth-07 parth-07 force-pushed the rev-calls-to-mem-fn branch 3 times, most recently from e22cc9e to 1d22708 Compare March 23, 2022 15:54
This commit adds support for differentiating calls to member functions
in the reverse mode AD.

This commit introduces a breaking change in the signature of derived member
functions. Earlier we were considering data members to be constant while differentiating
member functions. This is no longer the case, and thus now we need a separate variable
to store derivative of the function value with respect to implicit `this` pointer. To allow
users to obtain derivatives with respect to the implicit `this` object, derived member function
prototype has been changed to include a derivative parameter for the implicit `this` pointer.

For example:

```cpp
struct SomeStruct {
  double memFn(double i, long double j) {...}
};
```

This function will have the gradient function as follows:

```cpp
void memFn(double i, long double j, clad::array_ref<SomeStruct> _d_this, clad::array_ref<double> _d_i, clad::array_ref<double> _d_j) {...}
```
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

Successfully merging this pull request may close these issues.

1 participant