-
Notifications
You must be signed in to change notification settings - Fork 12
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
cannot differentiate getindex(::Tuple, ::Int) #61
Comments
Thanks for the report! Indeed, we have a diffrule for |
I think since dy -> (zero(T1), dy, zero(T2), zero(T3)) but to avoid unnecessary allocations I'm wondering how you represent zero here? (for reference, in Zygote, |
Currently there's no special handling of zeros since there was very few of them in my own experience. Do you have a motivating example where it is an issue? Unfortunately I didn't have time today to work out this issue completely, but here's the starting point (for my own reference) to proceed tomorrow:
(and yes, it uses exactly the trick with |
Hi thanks, yes, this will happen when I have a function returns two arrays, e.g function foo(..)
# some calculation
return A, B
end but only one of them is used. And a more concrete example is that this is exactly how Flux's recurrent layers are defined, and I believe it could happen in many multi-return functions. using |
The issue is now fixed on master and new version should be automatically tagged in a few hours. Thanks for RNN example, it's very intuitive and relevant. Indeed, it's possible to eliminate these allocations by propagating some kind of zero indicator, however I can't think out possible consequences of such a change right now, so I've created #63 as an idea for improved memory management. Please let me know if you have any issues with |
I tried this very simple code on current master branch
I guess it's because of a missing primitive for
getindex
?The text was updated successfully, but these errors were encountered: