Skip to content
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

Softmax fails on array of TrackedReal #19

Open
mboedigh opened this issue Apr 17, 2019 · 1 comment
Open

Softmax fails on array of TrackedReal #19

mboedigh opened this issue Apr 17, 2019 · 1 comment

Comments

@mboedigh
Copy link

I first noticed this problem with Flux 0.8.2, but it may have existed in earlier versions.

using Flux
tracked_array = Flux.param(Flux.glorot_uniform(10,3)); # tracked array of reals
Flux.softmax(tracked_array) # all good

array_of_tracked_reals = reduce(hcat, [tracked_array,tracked_array]);
Flux.softmax(array_of_tracked_reals) # fails with MethodError: no method matching softmax!(...)

I can get around it using hcat(...) #with splats, which creates a tracked_array of reals, but I would also like to use the array of tracked reals for other reasons.

@thebhatman
Copy link

thebhatman commented Apr 17, 2019

I think this has been fixed on NNlib master. This line https://github.com/FluxML/NNlib.jl/blob/40cee4b01021dfb1a6a14ba6dc05be636d05af1f/src/softmax.jl#L22 shows the correct way. Older versions of NNlib have where {T} <: AbstractFloat in this particular line which was the cause of the problem. Changing this to where {T} will make softmax work on an array of TrackedReals.

@MikeInnes MikeInnes transferred this issue from FluxML/Flux.jl Apr 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants