We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2540027 commit a12569aCopy full SHA for a12569a
src/functor.jl
@@ -51,8 +51,18 @@ end
51
"""
52
params(model)
53
54
-Given a model or specific layers from a model, return the trainable parameters
55
-such that they can be used as input to the `train!` function.
+Given a model or specific layers from a model, create a `Params` object pointing to its trainable parameters.
+
56
+This can be used with [`gradient`](@ref), or as input to the [`Flux.train!`](@ref Flux.train!) function.
57
58
+# Examples
59
+```jldoctest
60
+julia> params(Chain(Dense(ones(2,3))), softmax)
61
+Params([[1.0 1.0 1.0; 1.0 1.0 1.0], [0.0, 0.0]])
62
63
+julia> params(BatchNorm(2, relu))
64
+Params([Float32[0.0, 0.0], Float32[1.0, 1.0]])
65
+```
66
67
function params(m...)
68
ps = Params()
0 commit comments