-
Notifications
You must be signed in to change notification settings - Fork 26
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
ambiguity error in size(rec, dims...) #18
Comments
`size` is handled in AutoGrad/src/interfaces.jl L229-249.
…On Fri, Jun 30, 2017 at 11:28 AM Carlo Lucibello ***@***.***> wrote:
The following code works well
julia> f(x)=(p=size(x); p[1]*sum(x.^2))
julia> grad(f)(ones(3))3-element Array{Float64,1}:
6.0
6.0
6.0
and also size(x,1) doesn't give any problem, but here I have an ambiguity
error
julia> f(x)=(p=size(x,(1,2)...); p[1]*sum(x.^2))
WARNING: Method definition f(Any) in module Main at REPL[5]:1 overwritten at REPL[7]:1.
f (generic function with 1 method)
julia> grad(f)(ones(3,2,2,3))
ERROR: MethodError: size(::AutoGrad.Rec{Array{Float64,4}}, ::Int64, ::Int64, ::Int64) is ambiguous. Candidates:
size{N}(x, d1::Integer, d2::Integer, dx::Vararg{Integer,N}) at abstractarray.jl:48
size{##305}(x::AutoGrad.Rec{##305}, i...)
in f(::AutoGrad.Rec{Array{Float64,4}}) at ./REPL[7]:1
in forward_pass(::Function, ::Tuple{Array{Float64,4}}, ::Array{Any,1}, ::Int64) at /home/carlo/.julia/v0.5/AutoGrad/src/core.jl:88
in (::AutoGrad.##gradfun#1#3{#f,Int64})(::Array{Any,1}, ::Function, ::Array{Float64,4}, ::Vararg{Array{Float64,4},N}) at /home/carlo/.julia/v0.5/AutoGrad/src/core.jl:39
in (::AutoGrad.#gradfun#2)(::Array{Float64,4}, ::Vararg{Array{Float64,4},N}) at /home/carlo/.julia/v0.5/AutoGrad/src/core.jl:39
in eval_user_input(::Any, ::Base.REPL.REPLBackend) at ./REPL.jl:64
in macro expansion at ./REPL.jl:95 [inlined]
in (::Base.REPL.##3#4{Base.REPL.REPLBackend})() at ./event.jl:68
This could be fixed easily defining
size(x::AutoGrad.Rec, d1::Integer, d2::Integer, dx::Vararg{Integer}) = size(getval(x), d1, d2, dx...)
as I already tested. If someone points me to the right location where this
function should reside I can file a PR
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#18>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABvNpjaWqvhx6mWjYW5ZDzx5NW-NHz9Tks5sJLGngaJpZM4OKSr6>
.
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The following code works well
and also
size(x,1)
doesn't give any problem, but here I have an ambiguity errorThis could be fixed easily defining
as I already tested. If someone points me to the right location where this function should reside I can file a PR.
crossref denizyuret/Knet.jl#139
The text was updated successfully, but these errors were encountered: