Skip to content

Commit

Permalink
fix #2533
Browse files Browse the repository at this point in the history
  • Loading branch information
mcabbott committed Nov 25, 2024
1 parent bf5af30 commit 467ea36
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/deprecations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,20 @@ function params!(p::Zygote.Params, x, seen = IdSet())
end
end

"""
params(model)
Returns a `Zygote.Params` object containing all parameter arrays from the model.
This is deprecated!
This function was the cornerstone of how Flux used Zygote's implicit mode gradients,
but since Flux 0.13 we use explicit mode `gradient(m -> loss(m, x, y), model)` instead.
To collect all the parameter arrays for other purposes, use `Flux.trainables(model)`.
"""
function params(m...)
Base.depwarn("""
Flux.params(m...) is deprecated. Use `Flux.trainable(model)` for parameters' collection
and the explicit `gradient(m -> loss(m, x, y), model)` for gradient computation.
""", :params)
@warn """`Flux.params(m...)` is deprecated. Use `Flux.trainable(model)` for parameter collection,
and the explicit `gradient(m -> loss(m, x, y), model)` for gradient computation.""" maxlog=1
ps = Params()
params!(ps, m)
return ps
Expand Down

0 comments on commit 467ea36

Please sign in to comment.