-
Notifications
You must be signed in to change notification settings - Fork 62
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
Collapse zeros for Tuple
& Ref
tangents
#565
Conversation
Codecov Report
@@ Coverage Diff @@
## main #565 +/- ##
==========================================
- Coverage 93.14% 93.04% -0.10%
==========================================
Files 15 14 -1
Lines 875 877 +2
==========================================
+ Hits 815 816 +1
- Misses 60 61 +1
Continue to review full report at Codecov.
|
Xref discussion at #581, I guess that it would be slightly better for this to return a ZeroTangent than a NoTangent. |
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.
lgtm, just needs a version bump. I wonder whether we can abstract away the collapsing of the tangent somehow. Something like collapse(dy, whatever_it_is_if_not_NoTangent)
which would internally check if it is an AbstractZero
or a collection of AbstractZero
s. Might be an overkill
The stronger way to abstract this would just be to make the Tangent constructor return a Zero. I don't quite see why an all-Zero Tangent is ever better. |
This is one way not to make a Tangent with only zero types in it:
You could go further, and make
Tangent{Foo}()
andTangent{Foo}(x = NoTangent())
all returnNoTangent
. But perhaps it's odd to make a a type constructor not return that type... this PR does not do that.