Skip to content

Commit 4beb2a2

Browse files
committed
Clean the doctests further
1 parent 430f7a0 commit 4beb2a2

File tree

2 files changed

+17
-36
lines changed

2 files changed

+17
-36
lines changed

src/layers/normalise.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,13 @@ julia> y = m([1]);
7777
julia> y == [0]
7878
true
7979
80-
julia> m = Chain(Dense(1 => 1), Dropout(0.5));
80+
julia> m = Chain(Dense(1000 => 1000), Dropout(0.5));
8181
8282
julia> Flux.trainmode!(m);
8383
84-
julia> y = m([1]);
84+
julia> y = m(ones(1000));
8585
86-
julia> m[2].p - 0.5 <= count(i->(i == 0), y) <= m[2].p + 0.5 # number of zeros can be 0 or 1
86+
julia> isapprox(count(==(0), y) / length(y), 0.5, atol=0.1)
8787
true
8888
```
8989
"""
@@ -139,7 +139,7 @@ julia> Flux.trainmode!(m);
139139
140140
julia> y = m(x);
141141
142-
julia> isapprox(std(x), std(y), rtol=0.6)
142+
julia> isapprox(std(x), std(y), atol=0.6)
143143
true
144144
```
145145
"""

src/layers/recurrent.jl

Lines changed: 13 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -102,41 +102,22 @@ julia> rnn.state
102102
1×1 Matrix{Int64}:
103103
5
104104
105-
julia> vec = rnn(reshape(1:10, 1, 1, :)); # apply to a sequence of (features, batch, time)
105+
julia> out = rnn(reshape(1:10, 1, 1, :)); # apply to a sequence of (features, batch, time)
106106
107-
julia> size(vec)
107+
julia> out |> size
108108
(1, 1, 10)
109109
110-
julia> vec
111-
1×1×10 Array{Int64, 3}:
112-
[:, :, 1] =
113-
1
114-
115-
[:, :, 2] =
116-
2
117-
118-
[:, :, 3] =
119-
3
120-
121-
[:, :, 4] =
122-
4
123-
124-
[:, :, 5] =
125-
5
126-
127-
[:, :, 6] =
128-
6
129-
130-
[:, :, 7] =
131-
7
132-
133-
[:, :, 8] =
134-
8
135-
136-
[:, :, 9] =
137-
9
138-
139-
[:, :, 10] =
110+
julia> vec(out)
111+
10-element Vector{Int64}:
112+
1
113+
2
114+
3
115+
4
116+
5
117+
6
118+
7
119+
8
120+
9
140121
10
141122
142123
julia> rnn.state

0 commit comments

Comments
 (0)