loadparams!
This commit is contained in:
parent
6f0d5a44ec
commit
432b9c3222
@ -40,6 +40,14 @@ end
|
||||
|
||||
params(m...) = params(m)
|
||||
|
||||
function loadparams!(m, xs)
|
||||
for (p, x) in zip(params(m), xs)
|
||||
size(p) == size(x) ||
|
||||
error("Expected param size $(size(p)), got $(size(x))")
|
||||
copy!(data(p), data(x))
|
||||
end
|
||||
end
|
||||
|
||||
# CPU/GPU movement conveniences
|
||||
|
||||
cpu(m) = mapleaves(x -> adapt(Array, x), m)
|
||||
|
Loading…
Reference in New Issue
Block a user