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 Flux
struct Model
model
offset
end@Flux.functor Model (model,)
(m::Model)(x) =m.model(x+m.offset)
model =Model(Dense(1,1),[4])
p,re = Flux.destructure(model)
println(length(p)) #2 parameters
Flux.gradient((p)->sum(re(p)([1])),p) #doesn't work
The last lines throws an error DimensionMismatch("variable with size(x) == (2,) cannot have a gradient with size(dx) == (3,)")
The text was updated successfully, but these errors were encountered:
Title says all.
I could boil down my errors to this mwe.
The last lines throws an error
DimensionMismatch("variable with size(x) == (2,) cannot have a gradient with size(dx) == (3,)")
The text was updated successfully, but these errors were encountered: