-
Notifications
You must be signed in to change notification settings - Fork 14
Add documentation for recursive type demo #588
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
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅ 📢 Thoughts on this report? Let us know! |
Mooncake.jl documentation for PR #588 is available at: |
Performance Ratio:
|
The "known limitations" doc page (circular reference section) also contains some related but very brief explanations. |
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.
Very nice overview --- I'm just listing some things that would be icing on the cake, really.
docs/src/custom_tangent_type.md
Outdated
|
||
function TangentForA{Tx}(nt::@NamedTuple{x::Tx, a::Union{Mooncake.NoTangent, TangentForA{Tx}}}) where Tx | ||
return new{Tx}(nt.x, nt.a) | ||
end |
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.
Is this method necessary, or just for convenience?
If it's just for convenience, I think I'd prefer to leave it out, otherwise a reader may assume that it's part of the interface that's needed. If it's needed, then that should be mentioned IMO.
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.
Not necessary for this PR, but necessary to pass TestUtils.test_data
. Removing.
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 ok in that case actually it could be moved below too!
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.
Sorry, said too soon. It's indeed necessary here.
docs/src/custom_tangent_type.md
Outdated
|
||
### 4.2. `fdata_type` and `rdata_type` | ||
|
||
Define the types of forward and reverse data for `TangentForA`. In this example, since both `A` and `TangentForA` are mutable, all updates can be done in-place, so the `fdata` is the tangent itself and `rdata` is [`NoRData`](@ref). In other cases, you may need to split these more carefully. |
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.
Do you need to declare methods for fdata
and rdata
?
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.
Added a sentence for that.
docs/src/custom_tangent_type.md
Outdated
f1(a::A) = 2.0 * a.x | ||
``` | ||
|
||
When you try to differentiate this, Mooncake will complain it lacks an `rrule!!` for `lgetfield`. Implement it: |
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 a brief mention of what lgetfield
is might be useful
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.
Added a ref link
docs/src/custom_tangent_type.md
Outdated
## 6. From "It Works!" to Passing [`test_data`](@ref) | ||
|
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.
Would it be possible to have a snippet of using test_data
? (It's ok if it fails -- that's the point of this section, but I think it'd be nice to have a brief example of 'this is broken, below is how you fix it'.)
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.
I added all the code need to pass the test. Probably should live somewhere else, but okay for now.
This work on the documentation is really good, just added some comment for minor changes. beyond that it looks comprehensive and GTM. |
Co-authored-by: Astitva Aggarwal <84859349+AstitvaAggarwal@users.noreply.github.com> Signed-off-by: Xianda Sun <5433119+sunxd3@users.noreply.github.com>
Co-authored-by: Astitva Aggarwal <84859349+AstitvaAggarwal@users.noreply.github.com> Signed-off-by: Xianda Sun <5433119+sunxd3@users.noreply.github.com>
Co-authored-by: Astitva Aggarwal <84859349+AstitvaAggarwal@users.noreply.github.com> Signed-off-by: Xianda Sun <5433119+sunxd3@users.noreply.github.com>
Thanks both for the review! Really helpful. |
@sunxd3, you need to (re-)format the code to address the "quality" CI failures. |
I moved the new doc page to the "Developer" section. I'm happy to merge! |
Signed-off-by: Hong Ge <3279477+yebai@users.noreply.github.com>
thanks @yebai |
Signed-off-by: Hong Ge <3279477+yebai@users.noreply.github.com>
Partial solution to #428