-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[AutoDiff upstream] Add differentiability_witness_function
instruction.
#29765
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
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
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
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
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
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This instruction is very confusing to me (not sure if its just me though).
differentiability_witness_function
makes me think that this returns the witness. If this is looking up the associated differentiation function associated with a function would you be open to renaming this to something likedifferential
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This name is similar to ’witness_method’, where it returns a method from a witness. ‘differentiability_witness_function’ returns a function from a differentiability witness. “Differential” is not the technically right name and can cause confusion with the “differential” in our API. The returned function is not a differential, but a JVP/VJP (derivative) function.
I’m entirely open to renaming this to ‘derivative_function’, but I just wanted to clarify that the current name falls in line with the name ‘witness_method’.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, I thought Id looked through the rest and then came back and changed
differential
toderivative
. Id be okay withderivative_function
as well.The thing is that function becomes a fuzzy term here. It fetches the function pointer from the witness, returning a function which implements the function which performs a derivative over a function. The way that I initially read it, it made me question whether it was getting a getter for the differentiability witness or an entry in the witness table.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
derivative_function
is perhaps not wholly precise, because the instruction has a[transpose]
option for returning a transpose function, in addition to[jvp]
and[vjp]
options for returning derivative functions. I'm open toderivative_function
though.Do we have consensus on
derivative_function
(or some other name) as an alternative name fordifferentiability_witness_function
? cc @rxwei @marcrasiIf not, let's merge and defer renaming until later. I'll merge within a day if no one responds.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the future each witness will be either a linear witness or non-linear witness, so it’s possible to define both a ‘derivative_function’ and a ‘transpose_function’.
That said, I don’t like the idea of dropping the word “witness” from this instruction. It makes it sounds like it’s differentiating or transposing something, whereas all it does is retrieve the pointer to a function in the witness.
In the future when we unify JVP and VJP into a single derivative, a differentiability witness will be equivalent to a function forward declaration, so calling it ‘differentiability_witness_function’ is quite clear. I’m supporting keeping the existing name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting point. I'll go ahead and merge this patch now.