Skip to content

Commit e2254b4

Browse files
authored
Merge pull request #128 from FluxML/mcabbott-patch-2
Discourage use of `trainable`
2 parents d3a08f6 + 7131947 commit e2254b4

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/interface.jl

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,14 @@ maywrite(_) = false
147147
"""
148148
trainable(x::Layer) -> NamedTuple
149149
150-
This should be overloaded to make optimisers ignore some fields of
150+
This may be overloaded to make optimisers ignore some fields of
151151
every `Layer`, which would otherwise contain trainable parameters.
152-
(Elements such as functions and sizes are always ignored.)
152+
153+
!!! warning
154+
This is very rarely required. Fields of `struct Layer` which contain
155+
functions, or integers like sizes, are always ignored anyway.
156+
Overloading `trainable` is only necessary when some arrays of numbers
157+
are to be optimised, and some arrays of numbers are not.
153158
154159
The default is `Functors.children(x)`, usually a NamedTuple of all fields,
155160
and `trainable(x)` must contain a subset of these.

0 commit comments

Comments
 (0)