Skip to content

Commit 649afa6

Browse files
authored
Fix the "Gradients and Layers" documentation (#2628) (#2629)
* Update model definitions in basics.md to include identity function in Layer initialization * Revert "Update model definitions in basics.md to include identity function in Layer initialization" This reverts commit 9c90afb. * Update model definitions in basics.md to consistently include identity function in Layer initialization
1 parent 1eb451f commit 649afa6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

docs/src/guide/models/basics.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ Here's a composition of 3 functions, in which the last step is the function `onl
310310
which takes a 1-element vector and gives us the number inside:
311311

312312
```jldoctest poly; output = false, filter = r"[+-]?([0-9]*[.])?[0-9]+(f[+-]*[0-9])?"
313-
model1 = only ∘ Layer(20, 1) ∘ Layer(1, 20)
313+
model1 = only ∘ Layer(20, 1, identity) ∘ Layer(1, 20)
314314
315315
y = model1(Float32[0.1]) # output is a Float32 number
316316
@@ -331,7 +331,7 @@ This `model2` will work the same way (although its fields have different names):
331331
```jldoctest poly; output = false, filter = r"[+-]?([0-9]*[.])?[0-9]+(f[+-]*[0-9])?"
332332
model2 = let
333333
lay1 = Layer(1, 20) # local variables containing layers
334-
lay2 = Layer(20, 1)
334+
lay2 = Layer(20, 1, identity)
335335
function fwd(x) # equivalent to x -> only(lay2(lay1(x)))
336336
mid = lay1(x)
337337
lay2(mid) |> only

0 commit comments

Comments
 (0)