1175: xlogy broadcast adjoint r=MikeInnes a=MikeInnes
This is helpful for performance, since it avoids having to differentiate `xlogy` itself inside of a map.
Co-authored-by: Mike J Innes <mike.j.innes@gmail.com>
1174: Functors r=MikeInnes a=MikeInnes
Just splits out the implementation to the [Functors](https://github.com/FluxML/Functors.jl) package, so the same traits can be used elsewhere (e.g. Optimisers.jl) without depending on all of Flux.
Co-authored-by: Mike J Innes <mike.j.innes@gmail.com>
1166: Fix crossentropy when some probabilities are zero r=dhairyagandhi96 a=cossio
Use a function `xlogy(x,y) = x * log(y)` that has the correct limit at `x=0`.
Before this PR:
```julia
julia> Flux.crossentropy([0.1,0.0,0.9], [0.1,0.0,0.9])
NaN
```
After this PR:
```julia
julia> Flux.crossentropy([0.1,0.0,0.9], [0.1,0.0,0.9])
0.3250829733914482
```
Co-authored-by: cossio <j.cossio.diaz@gmail.com>
1160: Build docs on Julia 1.3 r=dhairyagandhi96 a=dhairyagandhi96
This causes red CI otherwise
Co-authored-by: Dhairya Gandhi <dhairya@juliacopmuting.com>
1156: Add correct overload for apply! in docs r=dhairyagandhi96 a=dhairyagandhi96
Maybe we should considering adding a `const` name that is better than `apply!` (or rename `apply!`) and export it, so folks can just overload `descriptive_apply_my_optimiser_rule!` rather than have to go to the sub-project `Flux.Optimise`?
Co-authored-by: Dhairya Gandhi <dhairya@juliacopmuting.com>
901: Add option for "Same" padding to conv and pooling layers r=dhairyagandhi96 a=DrChainsaw
Fixes#813
This adds the possibility to set "pad=SamePad()" to automatically calculate the amount of padding to apply so that outputsize==inputsize (assuming stide == 1).
Comments on API more than welcome. I considered the following options:
* Call the type just Same and export it, but I was afraid to cause name collisions due to a too generic name
* Call the type Same and not export it
* Dispatch on type instead of instance (so that one can type pad=Same instead of pad=Same())
* Supply a method instead of a type, giving a similar API as above.
Happy to change to any of the above or to anything else.
I don't think that same padding is common for pooling layers, but I added it just for the sake of consistency. It is a separate commit so it can easily be removed if not wanted.
Co-authored-by: DrChainsaw <Christian.kyril.skarby@gmail.com>