-
Notifications
You must be signed in to change notification settings - Fork 7
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
Tangent Interface Docs #434
Open
willtebbutt
wants to merge
16
commits into
main
Choose a base branch
from
wct/tangent-interface-docs
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
3f203b0
Rename test_tangent_consistency to test_tangent_interface
willtebbutt e46e9af
Merge branch 'main' into wct/tangent-interface-docs
willtebbutt f20bf79
Initial tangent docs
willtebbutt 42d1acf
Docstring formatting
willtebbutt 63deab4
Tweak tangent test cases
willtebbutt fa54fef
Fix tangent test case usage
willtebbutt 9c122bb
Tidy up test utils
willtebbutt 1100787
Rename test_fwds_rvs_data to test_tangent_splitting
willtebbutt 4aa09d8
More docs tweaks
willtebbutt 0c6d505
Link to new docs from existing
willtebbutt 1d061d9
Bump patch version
willtebbutt 9cf1d30
Formatting
willtebbutt 867aac5
Various typos
willtebbutt bec5da4
Formatting
willtebbutt cf0b143
Tidy up writing
willtebbutt 295e0e7
Apply suggestions from code review
willtebbutt 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 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 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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# Tangents | ||
|
||
As discussed in [Representing Gradients](@ref), Mooncake requires that each "primal" type be associated to a unique "tangent" type, given by the function [tangent_type](@ref). | ||
Moreover, we must be able to "split" a given tangent into its _fdata_ ("forwards-data") and _rdata_ ("reverse-data"), whose types are given by [fdata_type](@ref) and `rdata_type` respectively. | ||
|
||
Very occassionally it may be necessary to specify your own tangent type. | ||
This is not an entirely trivial undertaking, as there is quite a lot of functionality that must be added to make it work properly. | ||
So, before diving in to add your own custom type, seriously consider whether it is worth the effort, and whether the default definition given by Mooncake are really inadequate for your use-case. | ||
|
||
## Testing Functionality | ||
|
||
The interface is given in the form of three functions: | ||
```@docs | ||
Mooncake.TestUtils.test_tangent_interface | ||
Mooncake.TestUtils.test_tangent_splitting | ||
Mooncake.TestUtils.test_rule_and_type_interactions | ||
``` | ||
|
||
You can call all three of these functions at once using | ||
```@docs | ||
Mooncake.TestUtils.test_data | ||
``` | ||
|
||
If all the tests in these functions pass, then you have satisfied the interface. | ||
|
||
## Interface | ||
|
||
Below are the docstrings for each function tested by [`Mooncake.TestUtils.test_tangent_interface`](@ref) and [`Mooncake.TestUtils.test_tangent_splitting`](@ref). | ||
|
||
```@docs | ||
Mooncake.tangent_type | ||
Mooncake.zero_tangent | ||
Mooncake.randn_tangent | ||
Mooncake.TestUtils.has_equal_data | ||
Mooncake.increment!! | ||
Mooncake.set_to_zero!! | ||
Mooncake._add_to_primal | ||
Mooncake._diff | ||
Mooncake._dot | ||
Mooncake._scale | ||
Mooncake.TestUtils.populate_address_map | ||
Mooncake.fdata_type | ||
Mooncake.rdata_type | ||
Mooncake.fdata | ||
Mooncake.rdata | ||
Mooncake.uninit_fdata | ||
``` |
This file contains 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 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 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.
maybe miss
ref
forrdata_type
?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.
Ah, yes. For some reason, it didn't like me doing that. I'm not 100% sure why.