-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
zeros function mutates arguments #19265
Comments
This is an unintended consequence of the fact that |
I see, adding |
Allowing zeros(T::Type, dims::Dims) = fill!(Array{T}(dims), 0)
zeros(T::Type, dims::Integer...) = zeros(T, convert(Dims, dims)) and likewise for |
@martinholters's proposal sounds good.
Why don't use just use |
Ah usually I want say an array of |
@martinholters I can provide a PR with your suggestion if you like. |
We support this in |
The signature of similar is would you suggest to add |
@jw3126 Go ahead with a PR. But restricting the current signature to |
Removing a signature will cause code that used to "work" to error so I'm not sure how backportable is that. Sure, those code shouldn't be using this signature in the first place but there many other cases where we don't backport a change because of this. |
* Fix JuliaLang#19265. * Add methods to zeros, ones with analgous signature to similar.
* Fix JuliaLang#19265. * Add methods to zeros, ones with analgous signature to similar.
I was surprised by
zeros
sometimes mutating an array, I guess this is not intended:while
The text was updated successfully, but these errors were encountered: