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
I want to generate the gradient value at [1,2]. I wrote the following code to do this, but it gives an error. Thanks in advance for your help.
using Knet
J(w) = w[1]^2 .+ w[2]^2;
dJ = grad(J);
w = [1,2];
println(J(w))
println(dJ(w))
Output:
5
MethodError: ^(::AutoGrad.Rec{Int64}, ::Int64) is ambiguous. Candidates:
^(x, p::Integer) in Base at intfuncs.jl:199
^(x1::AutoGrad.Rec{##1045}, x2::##1046) where {##1045<:Number, ##1046<:Number} in AutoGrad
Possible fix, define
^(::AutoGrad.Rec{##1045<:Number}, ::Integer)
The text was updated successfully, but these errors were encountered:
I want to generate the gradient value at [1,2]. I wrote the following code to do this, but it gives an error. Thanks in advance for your help.
Output:
5
MethodError: ^(::AutoGrad.Rec{Int64}, ::Int64) is ambiguous. Candidates:
^(x, p::Integer) in Base at intfuncs.jl:199
^(x1::AutoGrad.Rec{##1045}, x2::##1046) where {##1045<:Number, ##1046<:Number} in AutoGrad
Possible fix, define
^(::AutoGrad.Rec{##1045<:Number}, ::Integer)
The text was updated successfully, but these errors were encountered: