-
Notifications
You must be signed in to change notification settings - Fork 93
add varargs nondiff rules #339
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
Changes from all commits
6d7bb40
ea38e7f
591dee3
2b6281d
02ba3ed
0d2ba57
b74e3f7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,54 +12,28 @@ end | |
@non_differentiable Random.randexp(::AbstractRNG) | ||
@non_differentiable Random.randstring(::AbstractRNG) | ||
|
||
@non_differentiable rand() | ||
@non_differentiable rand(::AbstractRNG) | ||
@non_differentiable rand(::AbstractRNG, ::Random.Sampler) | ||
@non_differentiable rand(::AbstractRNG, ::Integer) | ||
@non_differentiable rand(::AbstractRNG, ::Integer, ::Integer) | ||
@non_differentiable rand(::AbstractRNG, ::Integer, ::Integer, ::Integer) | ||
@non_differentiable rand(::AbstractRNG, ::Integer, ::Integer, ::Integer, ::Integer) | ||
@non_differentiable rand(::AbstractRNG, ::Integer, ::Integer, ::Integer, ::Integer, ::Integer) | ||
@non_differentiable rand(::AbstractRNG, ::Integer...) | ||
@non_differentiable rand(::Type{<:Real}) | ||
@non_differentiable rand(::Type{<:Real}, ::Tuple) | ||
@non_differentiable rand(::Type{<:Real}, ::Integer) | ||
@non_differentiable rand(::Type{<:Real}, ::Integer, ::Integer) | ||
@non_differentiable rand(::Type{<:Real}, ::Integer, ::Integer, ::Integer) | ||
@non_differentiable rand(::Type{<:Real}, ::Integer, ::Integer, ::Integer, ::Integer) | ||
@non_differentiable rand(::Type{<:Real}, ::Integer, ::Integer, ::Integer, ::Integer, ::Integer) | ||
@non_differentiable rand(::Integer) | ||
@non_differentiable rand(::Integer, ::Integer) | ||
@non_differentiable rand(::Integer, ::Integer, ::Integer) | ||
@non_differentiable rand(::Integer, ::Integer, ::Integer, ::Integer) | ||
@non_differentiable rand(::Integer, ::Integer, ::Integer, ::Integer, ::Integer) | ||
|
||
@non_differentiable rand(::Type{<:Real}, ::Integer...) | ||
@non_differentiable rand(::Integer...) | ||
|
||
# There are many different 1-3 arg methods, but not varargs | ||
@non_differentiable rand!(::Any) | ||
@non_differentiable rand!(::Any, ::Any) | ||
@non_differentiable rand!(::Any, ::Any, ::Any) | ||
|
||
@non_differentiable randexp(::Any) | ||
@non_differentiable randexp(::Any, ::Any) | ||
@non_differentiable randexp(::Any, ::Any, ::Any) | ||
@non_differentiable randexp(::Any, ::Any, ::Any, ::Any) | ||
@non_differentiable randexp(::Any, ::Any, ::Any, ::Any, ::Any) | ||
@non_differentiable randexp(::Any...) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Great, this was actually missing a |
||
|
||
@non_differentiable randexp!(::AbstractArray) | ||
@non_differentiable randexp!(::AbstractRNG, ::AbstractArray) | ||
|
||
@non_differentiable randn() | ||
@non_differentiable randn(::Any) | ||
@non_differentiable randn(::Any, ::Any) | ||
@non_differentiable randn(::Any, ::Any, ::Any) | ||
@non_differentiable randn(::Any, ::Any, ::Any, ::Any) | ||
@non_differentiable randn(::Any, ::Any, ::Any, ::Any, ::Any) | ||
@non_differentiable randn(::Any...) | ||
|
||
@non_differentiable randn!(::AbstractArray) | ||
@non_differentiable randn!(::AbstractRNG, ::AbstractArray) | ||
|
||
|
||
@non_differentiable randn(::AbstractRNG) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Was this line removed by accident, or am I missing something? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it is covered already by |
||
@non_differentiable copy(::AbstractRNG) | ||
@non_differentiable copy!(::AbstractRNG, ::AbstractRNG) | ||
|
||
|
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'm unsure about what this comment means, so I didn't replace it by
rand!(::Any...)
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.
The comment means that the function
rand!
has many different method definitions, which you can see by typingmethods(rand!)
in the REPL. However, if you look closely, none of them have aVararg
(or...
) in the arguments. So, it is correct not to replace it, as it would lead to incorrect results in case someone defined a differentiablerand!
method with four arguments.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.
Now I see, thank you!