julia> versioninfo()
Julia Version 1.7.3
Commit 742b9abb4d (2022-05-06 12:58 UTC)
Platform Info:
OS: Windows (x86_64-w64-mingw32)
CPU: Intel(R) Core(TM) i5-4570 CPU @ 3.20GH
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-12.0.1 (ORCJIT, haswell)
(@v1.7) pkg> st Flux
Status `C:\Users\Hermesr\.julia\environments\v1.7\Project.toml`
[587475ba] Flux v0.13.3
using Flux
W = rand(collect(1.0:1:10),2, 5)
b = rand(collect(1.0:1:10),2)
f(x) = W*x .+ b
x = rand(collect(1.0:1:10),5)
p = Flux.params([W,b])
grads = gradient(() -> f(x)[1],p)
grads[W]
grads[b]
function loss(x, y)
ŷ = f(x)
sum((y .- ŷ).^2)
end
x, y = rand(5), rand(2)
loss(x, y)
parameters = Flux.params([W, b])
gs = gradient(() -> loss(x, y),parameters)
Δ = gs[W]
using Flux: update!
Flux.update!(W, 0.1.*Δ)
ERROR: UndefVarError: depwarn not defined
That’s a bug in Flux:
Should call Base.depwarn
.
Made a PR deprecations.jl: depwarn -> Base.depwarn by skleinbo · Pull Request #1985 · FluxML/Flux.jl · GitHub