-
Notifications
You must be signed in to change notification settings - Fork 3
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
Difference in the implementation of slicemap and mapcols #14
Comments
Yes, they have quite different paths. But |
After some more testing, I have concluded that in some situations one is better, in other situations the other is better. I am not sure what is the rule.
It also works with Forward and ReverseDiff. Is that normal? Also, a curious behavior that I have observed is that
|
With these, this package is not involved in derivatives at all. I suspect that this means ReverseDiff is tracking each number, not whole arrays, and will be quite slow, but haven't tested.
I was confused for a bit, but this is in fact expected. The help says:
This was enough for what I needed, I don't quite recall whether tracking or accumulating the gradient of |
With some light testing with the functions above, it seems that ReverseDiff is about 5 times slower than Zygote.
Is there any technical reason not to implement them? I would gladly look into it. Or should we just hope that |
The implementation of slicemap and mapcols is fundamentally different. Intuitively, this is relatively weird because
mapcols(f,M)=slicemap(f,M,dims=1)
and
slicemap(f,M,dims=1)=reshape(mapcols(f,reshape(M,size(M,1),:)),size(M))
(if
dims
is not equal to 1, then one could just use PermutedDimsArray)After some (light) testing, I have the impression that using
mapcols
is about 25% faster than using slicemap. Is that a general result or specific to my application? Would there be any advantage on using either one or the other implementations?The text was updated successfully, but these errors were encountered: