From 9c90afb7c5f9ced559c487cda4b6d3f61fbba651 Mon Sep 17 00:00:00 2001 From: Go Komura Date: Mon, 24 Nov 2025 17:00:29 +0900 Subject: [PATCH 1/3] Update model definitions in basics.md to include identity function in Layer initialization --- docs/src/guide/models/basics.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/src/guide/models/basics.md b/docs/src/guide/models/basics.md index a0eabeed6f..27a958074c 100644 --- a/docs/src/guide/models/basics.md +++ b/docs/src/guide/models/basics.md @@ -310,7 +310,7 @@ Here's a composition of 3 functions, in which the last step is the function `onl which takes a 1-element vector and gives us the number inside: ```jldoctest poly; output = false, filter = r"[+-]?([0-9]*[.])?[0-9]+(f[+-]*[0-9])?" -model1 = only ∘ Layer(20, 1) ∘ Layer(1, 20) +model1 = only ∘ Layer(20, 1, identity) ∘ Layer(1, 20) y = model1(Float32[0.1]) # output is a Float32 number @@ -331,7 +331,7 @@ This `model2` will work the same way (although its fields have different names): ```jldoctest poly; output = false, filter = r"[+-]?([0-9]*[.])?[0-9]+(f[+-]*[0-9])?" model2 = let lay1 = Layer(1, 20) # local variables containing layers - lay2 = Layer(20, 1) + lay2 = Layer(20, 1, identity) function fwd(x) # equivalent to x -> only(lay2(lay1(x))) mid = lay1(x) lay2(mid) |> only From eaf5f849ef699ea0bc77d4f34ff3eaa56a33823f Mon Sep 17 00:00:00 2001 From: Go Komura Date: Mon, 24 Nov 2025 17:03:40 +0900 Subject: [PATCH 2/3] Revert "Update model definitions in basics.md to include identity function in Layer initialization" This reverts commit 9c90afb7c5f9ced559c487cda4b6d3f61fbba651. --- docs/src/guide/models/basics.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/src/guide/models/basics.md b/docs/src/guide/models/basics.md index 27a958074c..a0eabeed6f 100644 --- a/docs/src/guide/models/basics.md +++ b/docs/src/guide/models/basics.md @@ -310,7 +310,7 @@ Here's a composition of 3 functions, in which the last step is the function `onl which takes a 1-element vector and gives us the number inside: ```jldoctest poly; output = false, filter = r"[+-]?([0-9]*[.])?[0-9]+(f[+-]*[0-9])?" -model1 = only ∘ Layer(20, 1, identity) ∘ Layer(1, 20) +model1 = only ∘ Layer(20, 1) ∘ Layer(1, 20) y = model1(Float32[0.1]) # output is a Float32 number @@ -331,7 +331,7 @@ This `model2` will work the same way (although its fields have different names): ```jldoctest poly; output = false, filter = r"[+-]?([0-9]*[.])?[0-9]+(f[+-]*[0-9])?" model2 = let lay1 = Layer(1, 20) # local variables containing layers - lay2 = Layer(20, 1, identity) + lay2 = Layer(20, 1) function fwd(x) # equivalent to x -> only(lay2(lay1(x))) mid = lay1(x) lay2(mid) |> only From 70fec3d9f5074aec77059c485706f3e39305975c Mon Sep 17 00:00:00 2001 From: Go Komura Date: Mon, 24 Nov 2025 17:53:41 +0900 Subject: [PATCH 3/3] Update model definitions in basics.md to consistently include identity function in Layer initialization --- docs/src/guide/models/basics.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/src/guide/models/basics.md b/docs/src/guide/models/basics.md index a0eabeed6f..27a958074c 100644 --- a/docs/src/guide/models/basics.md +++ b/docs/src/guide/models/basics.md @@ -310,7 +310,7 @@ Here's a composition of 3 functions, in which the last step is the function `onl which takes a 1-element vector and gives us the number inside: ```jldoctest poly; output = false, filter = r"[+-]?([0-9]*[.])?[0-9]+(f[+-]*[0-9])?" -model1 = only ∘ Layer(20, 1) ∘ Layer(1, 20) +model1 = only ∘ Layer(20, 1, identity) ∘ Layer(1, 20) y = model1(Float32[0.1]) # output is a Float32 number @@ -331,7 +331,7 @@ This `model2` will work the same way (although its fields have different names): ```jldoctest poly; output = false, filter = r"[+-]?([0-9]*[.])?[0-9]+(f[+-]*[0-9])?" model2 = let lay1 = Layer(1, 20) # local variables containing layers - lay2 = Layer(20, 1) + lay2 = Layer(20, 1, identity) function fwd(x) # equivalent to x -> only(lay2(lay1(x))) mid = lay1(x) lay2(mid) |> only