Closed YichengDWu closed 4 months ago
Yeah, it should. That's weird. I might get a chance to look at it this weekend.
julia> ps = ComponentArray(weight=rand(3,3))
ComponentVector{Float64}(weight = [0.3364916316745368 0.16747972646975107 0.961114830406715; 0.7662896569815121 0.21684158229208028 0.8580540237329293; 0.13361739374272052 0.6107957888988388 0.27262419344861877])
julia> grad = Zygote.gradient(x->sum(x.weight), ps)[1]
ComponentVector{Float64}(weight = [1.0 1.0 1.0; 1.0 1.0 1.0; 1.0 1.0 1.0])
This was fixed with the ProjectTo
PR.
In the following code, shouldn't
grad
be of the same type asx
?