-
-
Notifications
You must be signed in to change notification settings - Fork 614
Open
Description
Given too many parameters, or parameters of the wrong shapes, destructure
and loadparams!
silently have a go. I believe it would be safer to make these errors. Or at least warnings:
using Flux
m1 = Chain(Dense(2,2), Dense(2,2))
m1[1].W .= 1
v1, re1 = Flux.destructure(m1)
m2 = re1(rand(100)) # doesn't check length
m2[1].W # new values
m3 = Chain(Dense(2,2), Dense(2,2), Dense(2,2))
Flux.loadparams!(m1, params(m3)) # doesn't check length
m1[1].W # has been overwritten
m4 = Chain(Dense(2,2), Dense(2,3), Dense(3,2))
Flux.loadparams!(m1, params(m3)) # doesn't check shape either
When there are too few parameters, it does it seem to fail:
Flux.loadparams!(m4, params(m1)) # ERROR: Expected param size (3, 2), got (2, 2)
re1(rand(3)) # ERROR: BoundsError: attempt to access 3-element Array{Float64,1} at index [1:4]
Metadata
Metadata
Assignees
Labels
No labels