-
-
Notifications
You must be signed in to change notification settings - Fork 608
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
Mark initialisations nograd, restrict signatures #1908
Conversation
test/utils.jl
Outdated
@test size(init(3)) == (3,) | ||
end | ||
@test size(init(3, 4)) == (3, 4) | ||
@test_skip size(init((3, 4, 5))) == (3, 4, 5) |
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 all of them accept a size tuple like this. Should they?
Or perhaps they should all only accept init(size::Integer...)
?
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.
+1 for the latter.
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.
Done in 9d1f5d5
I guess that makes this breaking, hence v0.13
Is there a use case for having init functions succeed in a gradient context? Could we throw a more informative error in the rrule instead? |
I can't think of a use. I guess the argument here is that they are variants of
|
Codecov Report
@@ Coverage Diff @@
## master #1908 +/- ##
==========================================
+ Coverage 86.23% 86.64% +0.41%
==========================================
Files 18 18
Lines 1438 1445 +7
==========================================
+ Hits 1240 1252 +12
+ Misses 198 193 -5
Continue to review full report at Codecov.
|
Inspired by this:
https://discourse.julialang.org/t/mutating-arrays-not-supported-toy-problem/78057
this PR adds
@non_differentiable
to all initialisation functions.