You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On Thu, Apr 6, 2017 at 6:58 AM ngphuoc ***@***.***> wrote:
I am trying to add L2 regularization at the end ofs2s() method in
prof/s2s.jl and get the mentioned error. The added line is
sumlogp += 0.001 * sum(sumabs2(a) for (k,a) in model if isa(a, KnetArray))
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#109>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABvNpvT9H8I_NH-AwWYABjNuhSPSGy2vks5rtGLjgaJpZM4M1Fym>
.
isa(a, KnetArray) won't work, you need isa(getval(a),KnetArray). When you index elements of a model AutoGrad changes their type to keep track of dependencies.
Finally this won't work either because the model has a hierarchical structure and not all values are KnetArrays. If you really want to calculate L2, I'd write a function that explicitly goes through model[:embed1], model[:encode][1], model[:encode][2] etc.
I am trying to add L2 regularization at the end of
s2s()
method inprof/s2s.jl
and get the mentioned error. The added line isThe text was updated successfully, but these errors were encountered: