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
using Tracker
using LinearAlgebra
X =randn(3, 3)
functiong1(x)
y =UpperTriangular(x)
sum(y * y)
end
Tracker.gradient(g1, X)
throw:
MethodError: Cannot `convert` an object of type Array{Float64,2} to an object of type UpperTriangular{Float64,Array{Float64,2}}
Closest candidates are:
convert(::Type{var"#s826"} where var"#s826"<:UpperTriangular, !Matched::Union{UnitUpperTriangular, UpperTriangular}) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/LinearAlgebra/src/special.jl:61
convert(::Type{var"#s826"} where var"#s826"<:UpperTriangular, !Matched::Union{LinearAlgebra.AbstractTriangular, Bidiagonal, Diagonal}) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/LinearAlgebra/src/special.jl:65
convert(::Type{T}, !Matched::T) where T<:AbstractArray at abstractarray.jl:14
...
Stacktrace:
[1] setproperty!(::Tracker.Tracked{UpperTriangular{Float64,Array{Float64,2}}}, ::Symbol, ::Array{Float64,2}) at ./Base.jl:34
[2] back(::Tracker.Tracked{UpperTriangular{Float64,Array{Float64,2}}}, ::Array{Float64,2}, ::Bool) at /home/yiyuezhuo/.julia/packages/Tracker/AMi2h/src/back.jl:53
[3] #13 at /home/yiyuezhuo/.julia/packages/Tracker/AMi2h/src/back.jl:38 [inlined]
[4] foreach at ./abstractarray.jl:2010 [inlined]
[5] back_(::Tracker.Call{Tracker.var"#521#522"{TrackedArray{…,UpperTriangular{Float64,Array{Float64,2}}},TrackedArray{…,UpperTriangular{Float64,Array{Float64,2}}}},Tuple{Tracker.Tracked{UpperTriangular{Float64,Array{Float64,2}}},Tracker.Tracked{UpperTriangular{Float64,Array{Float64,2}}}}}, ::Array{Float64,2}, ::Bool) at /home/yiyuezhuo/.julia/packages/Tracker/AMi2h/src/back.jl:38
[6] back(::Tracker.Tracked{UpperTriangular{Float64,Array{Float64,2}}}, ::Array{Float64,2}, ::Bool) at /home/yiyuezhuo/.julia/packages/Tracker/AMi2h/src/back.jl:58
[7] #13 at /home/yiyuezhuo/.julia/packages/Tracker/AMi2h/src/back.jl:38 [inlined]
[8] foreach at ./abstractarray.jl:2010 [inlined]
[9] back_(::Tracker.Call{Tracker.var"#494#495"{TrackedArray{…,UpperTriangular{Float64,Array{Float64,2}}}},Tuple{Tracker.Tracked{UpperTriangular{Float64,Array{Float64,2}}}}}, ::Float64, ::Bool) at /home/yiyuezhuo/.julia/packages/Tracker/AMi2h/src/back.jl:38
[10] back(::Tracker.Tracked{Float64}, ::Int64, ::Bool) at /home/yiyuezhuo/.julia/packages/Tracker/AMi2h/src/back.jl:58
[11] #back!#15 at /home/yiyuezhuo/.julia/packages/Tracker/AMi2h/src/back.jl:77 [inlined]
[12] #back!#32 at /home/yiyuezhuo/.julia/packages/Tracker/AMi2h/src/lib/real.jl:16 [inlined]
[13] back!(::Tracker.TrackedReal{Float64}) at /home/yiyuezhuo/.julia/packages/Tracker/AMi2h/src/lib/real.jl:14
[14] gradient_(::Function, ::Array{Float64,2}) at /home/yiyuezhuo/.julia/packages/Tracker/AMi2h/src/back.jl:4
[15] #gradient#24 at /home/yiyuezhuo/.julia/packages/Tracker/AMi2h/src/back.jl:164 [inlined]
[16] gradient(::Function, ::Array{Float64,2}) at /home/yiyuezhuo/.julia/packages/Tracker/AMi2h/src/back.jl:164
[17] top-level scope at In[43]:1
[18] include_string(::Function, ::Module, ::String, ::String) at ./loading.jl:1091
Product of two Triangular matrix (result is dense matrix):
functiong2(x)
y =UpperTriangular(x)
sum(y'* y)
end
Tracker.gradient(g2, X)
throw:
MethodError: Cannot `convert` an object of type Base.ReshapedArray{Float64,2,Adjoint{Float64,Array{Float64,2}},Tuple{Base.MultiplicativeInverses.SignedMultiplicativeInverse{Int64}}} to an object of type UpperTriangular{Float64,Array{Float64,2}}
Closest candidates are:
convert(::Type{var"#s826"} where var"#s826"<:UpperTriangular, !Matched::Union{UnitUpperTriangular, UpperTriangular}) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/LinearAlgebra/src/special.jl:61
convert(::Type{var"#s826"} where var"#s826"<:UpperTriangular, !Matched::Union{LinearAlgebra.AbstractTriangular, Bidiagonal, Diagonal}) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/LinearAlgebra/src/special.jl:65
convert(::Type{T}, !Matched::T) where T<:AbstractArray at abstractarray.jl:14
...
Stacktrace:
[1] setproperty!(::Tracker.Tracked{UpperTriangular{Float64,Array{Float64,2}}}, ::Symbol, ::Base.ReshapedArray{Float64,2,Adjoint{Float64,Array{Float64,2}},Tuple{Base.MultiplicativeInverses.SignedMultiplicativeInverse{Int64}}}) at ./Base.jl:34
[2] back(::Tracker.Tracked{UpperTriangular{Float64,Array{Float64,2}}}, ::Base.ReshapedArray{Float64,2,Adjoint{Float64,Array{Float64,2}},Tuple{Base.MultiplicativeInverses.SignedMultiplicativeInverse{Int64}}}, ::Bool) at /home/yiyuezhuo/.julia/packages/Tracker/AMi2h/src/back.jl:53
[3] #13 at /home/yiyuezhuo/.julia/packages/Tracker/AMi2h/src/back.jl:38 [inlined]
[4] foreach at ./abstractarray.jl:2010 [inlined]
[5] back_(::Tracker.Call{Tracker.var"#392#393"{TrackedArray{…,UpperTriangular{Float64,Array{Float64,2}}}},Tuple{Tracker.Tracked{UpperTriangular{Float64,Array{Float64,2}}}}}, ::Array{Float64,2}, ::Bool) at /home/yiyuezhuo/.julia/packages/Tracker/AMi2h/src/back.jl:38
[6] back(::Tracker.Tracked{Adjoint{Float64,UpperTriangular{Float64,Array{Float64,2}}}}, ::Array{Float64,2}, ::Bool) at /home/yiyuezhuo/.julia/packages/Tracker/AMi2h/src/back.jl:58
[7] #13 at /home/yiyuezhuo/.julia/packages/Tracker/AMi2h/src/back.jl:38 [inlined]
[8] foreach at ./abstractarray.jl:2010 [inlined]
[9] back_(::Tracker.Call{Tracker.var"#521#522"{TrackedArray{…,Adjoint{Float64,UpperTriangular{Float64,Array{Float64,2}}}},TrackedArray{…,UpperTriangular{Float64,Array{Float64,2}}}},Tuple{Tracker.Tracked{Adjoint{Float64,UpperTriangular{Float64,Array{Float64,2}}}},Tracker.Tracked{UpperTriangular{Float64,Array{Float64,2}}}}}, ::Array{Float64,2}, ::Bool) at /home/yiyuezhuo/.julia/packages/Tracker/AMi2h/src/back.jl:38
[10] back(::Tracker.Tracked{Array{Float64,2}}, ::Array{Float64,2}, ::Bool) at /home/yiyuezhuo/.julia/packages/Tracker/AMi2h/src/back.jl:58
[11] #13 at /home/yiyuezhuo/.julia/packages/Tracker/AMi2h/src/back.jl:38 [inlined]
[12] foreach at ./abstractarray.jl:2010 [inlined]
[13] back_(::Tracker.Call{Tracker.var"#494#495"{TrackedArray{…,Array{Float64,2}}},Tuple{Tracker.Tracked{Array{Float64,2}}}}, ::Float64, ::Bool) at /home/yiyuezhuo/.julia/packages/Tracker/AMi2h/src/back.jl:38
[14] back(::Tracker.Tracked{Float64}, ::Int64, ::Bool) at /home/yiyuezhuo/.julia/packages/Tracker/AMi2h/src/back.jl:58
[15] #back!#15 at /home/yiyuezhuo/.julia/packages/Tracker/AMi2h/src/back.jl:77 [inlined]
[16] #back!#32 at /home/yiyuezhuo/.julia/packages/Tracker/AMi2h/src/lib/real.jl:16 [inlined]
[17] back!(::Tracker.TrackedReal{Float64}) at /home/yiyuezhuo/.julia/packages/Tracker/AMi2h/src/lib/real.jl:14
[18] gradient_(::Function, ::Array{Float64,2}) at /home/yiyuezhuo/.julia/packages/Tracker/AMi2h/src/back.jl:4
[19] #gradient#24 at /home/yiyuezhuo/.julia/packages/Tracker/AMi2h/src/back.jl:164 [inlined]
[20] gradient(::Function, ::Array{Float64,2}) at /home/yiyuezhuo/.julia/packages/Tracker/AMi2h/src/back.jl:164
[21] top-level scope at In[45]:6
[22] include_string(::Function, ::Module, ::String, ::String) at ./loading.jl:1091
While it seems that one can get gradient if just one argument is Triangular matrix:
functiong3(x)
y =UpperTriangular(x)
sum(2*y'.+1)
end
Tracker.gradient(g3, X)
Product of two Triangular matrix:
throw:
Product of two Triangular matrix (result is dense matrix):
throw:
While it seems that one can get gradient if just one argument is
Triangular
matrix:gives:
The text was updated successfully, but these errors were encountered: