Skip to content

Commit 53331e4

Browse files
committed
Use the |> syntax in the migration guide examples
1 parent 03f5086 commit 53331e4

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

docs/migration_guide.md

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,7 @@ let%op model () =
7878
let conv1 = conv2d ~kernel_size:3 () in
7979
let pool = max_pool2d () in
8080
fun x ->
81-
let x = conv1 x in
82-
let x = relu x in
83-
let x = pool x in
81+
let x = conv1 x |> relu |> pool in
8482
(* No flattening needed - FC layer works with spatial dims *)
8583
{ w_out } * x + { b_out = 0.; o = [10] }
8684
```
@@ -116,11 +114,7 @@ let%op resnet_block () =
116114
let bn2 = batch_norm2d () in
117115
fun ~train_step x ->
118116
let identity = x in
119-
let out = conv1 x in
120-
let out = bn1 ~train_step out in
121-
let out = relu out in
122-
let out = conv2 out in
123-
let out = bn2 ~train_step out in
117+
let out = conv1 x |> bn1 ~train_step |> relu |> conv2 |> bn2 ~train_step in
124118
relu (out + identity)
125119
```
126120

0 commit comments

Comments
 (0)