-
-
Notifications
You must be signed in to change notification settings - Fork 611
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
TrackedArrays and Scalars with a Chain #179
Comments
Yeah, that's correct, see also #108. This is a fundamental design choice that Base Julia has made, so there's not much we can really do about it: julia> tanh([1,2,3])
WARNING: tanh(x::AbstractArray{T}) where T <: Number is deprecated, use tanh.(x) instead.
Stacktrace:
[1] depwarn(::String, ::Symbol) at ./deprecated.jl:70
[2] tanh(::Array{Int64,1}) at ./deprecated.jl:57
[3] eval(::Module, ::Any) at ./boot.jl:235
[4] eval_user_input(::Any, ::Base.REPL.REPLBackend) at ./REPL.jl:66
[5] macro expansion at ./REPL.jl:97 [inlined]
[6] (::Base.REPL.##1#2{Base.REPL.REPLBackend})() at ./event.jl:73
while loading no file, in expression starting on line 0
3-element Array{Float64,1}:
0.761594
0.964028
0.995055 One way to make it more convenient would be to write something like Although it's somewhat unusual among DL frameworks, closures are a pattern we use quite often in Flux (e.g. |
Up to you of course, but there might be reason to go against the Julia design choice, since you could say that a |
One possibility would be that It's not great to just special case a bunch of possible activation functions, and especially not to override Base's versions (e.g. for |
Yeah I don't know either. Possibly this might be solved nicely with traits? |
Let |
FluxML/NNlib.jl#98 will give a nicer error message here. I don't think there's much we can do beyond that. I guess if someone wants to PR |
Is this expected behaviour?
To get this to work we have to write:
which is potentially a little counter intuitive.
Now you might be tempted to reply "you should just use
m = Chain(Dense(5, 1, σ))
".But if one has a sigmoid activated dense layer
Dense(5, 1, σ)
, it's really complicated to pop the sigmoid layer and extract the features if your model is parameterised in that way. Cf.The text was updated successfully, but these errors were encountered: