-
-
Notifications
You must be signed in to change notification settings - Fork 36
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
Behavior on vcat
of scalars
#172
Labels
bug
Something isn't working
Comments
Shorter example: julia> Tracker.gradient(sum∘vcat, [1.0, 2.0], [3.0]) # fine
([1.0, 1.0] (tracked), [1.0] (tracked))
julia> Tracker.gradient(sum∘vcat, 1.0, 2.0) # creates a vector where it wants a scalar
ERROR: MethodError: Cannot `convert` an object of type Vector{Float64} to an object of type Float64
Stacktrace:
[1] setproperty!(x::Tracker.Tracked{Float64}, f::Symbol, v::Vector{Float64})
@ Base ./Base.jl:52
[2] back(x::Tracker.Tracked{Float64}, Δ::Vector{Float64}, once::Bool)
@ Tracker ~/.julia/packages/Tracker/6rnwO/src/back.jl:48
[3] (::Tracker.var"#707#708"{Bool})(x::Tracker.Tracked{Float64}, d::Vector{Float64})
@ Tracker ~/.julia/packages/Tracker/6rnwO/src/back.jl:38
julia> Tracker.gradient(sum∘vcat, [1.0, 2.0], 3.0) # same error with mix of vector & scalar args
ERROR: MethodError: Cannot `convert` an object of type Vector{Float64} to an object of type Float64 Note that I wouldn't call this "inconsistent", it seems to always go wrong. The other function |
vcat
of scalarsvcat
of scalars
Lines 214 to 220 in ce231f9
hcat has a similar code path and thus a similar problem. Base.vect does not appear to have a rule, so Tracker traces through it transparently and the individual tracked scalars remain intact.
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here's an inconsistency I discovered based on two ways of constructing vectors from floats:
The text was updated successfully, but these errors were encountered: