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 e21b094 commit 73351c7Copy full SHA for 73351c7
src/functor.jl
@@ -60,11 +60,23 @@ The behaviour of `params` on custom types can be customized using [`Functor.@fun
60
61
# Examples
62
```jldoctest
63
-julia> params(Chain(Dense(ones(2,3))), softmax)
+julia> params(Chain(Dense(ones(2,3)), softmax)) # unpacks Flux models
64
Params([[1.0 1.0 1.0; 1.0 1.0 1.0], [0.0, 0.0]])
65
66
-julia> params(BatchNorm(2, relu))
+julia> bn = BatchNorm(2, relu)
67
+BatchNorm(2, relu) # 4 parameters, plus 4 non-trainable
68
+
69
+julia> params(bn) # only the trainable parameters
70
Params([Float32[0.0, 0.0], Float32[1.0, 1.0]])
71
72
+julia> params([1, 2, 3], [4.0]) # one or more arrays of numbers
73
+Params([[1, 2, 3], [4.0]])
74
75
+julia> params([[1, 2, 3], [4.0]]) # unpacks array of arrays
76
77
78
+julia> params(1, [2 2], (alpha=[3,3,3], beta=Ref(4), gamma=sin)) # ignores scalars, unpacks NamedTuples
79
+Params([[2 2], [3, 3, 3]])
80
```
81
"""
82
function params(m...)
0 commit comments