Skip to content

Commit fbd2ad2

Browse files
committed
warning syntax
1 parent 1912402 commit fbd2ad2

File tree

1 file changed

+28
-23
lines changed

1 file changed

+28
-23
lines changed

src/layers/recurrent.jl

Lines changed: 28 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -142,33 +142,35 @@ julia> r(rand(Float32, 3, 10)) |> size # batch size of 10
142142
(5, 10)
143143
```
144144
145-
!!! warning Failing to call `reset!` when the input batch size changes can lead to unexpected behavior. See the following example:
145+
!!! warning "Batch size changes"
146+
147+
Failing to call `reset!` when the input batch size changes can lead to unexpected behavior. See the following example:
146148
147-
```julia
148-
julia> r = RNN(3, 5)
149-
Recur(
150-
RNNCell(3, 5, tanh), # 50 parameters
151-
) # Total: 4 trainable arrays, 50 parameters,
152-
# plus 1 non-trainable, 5 parameters, summarysize 432 bytes.
149+
```julia
150+
julia> r = RNN(3, 5)
151+
Recur(
152+
RNNCell(3, 5, tanh), # 50 parameters
153+
) # Total: 4 trainable arrays, 50 parameters,
154+
# plus 1 non-trainable, 5 parameters, summarysize 432 bytes.
153155
154-
julia> r.state |> size
155-
(5, 1)
156+
julia> r.state |> size
157+
(5, 1)
156158
157-
julia> r(rand(Float32, 3)) |> size
158-
(5,)
159+
julia> r(rand(Float32, 3)) |> size
160+
(5,)
159161
160-
julia> r.state |> size
161-
(5, 1)
162+
julia> r.state |> size
163+
(5, 1)
162164
163-
julia> r(rand(Float32, 3, 10)) |> size # batch size of 10
164-
(5, 10)
165+
julia> r(rand(Float32, 3, 10)) |> size # batch size of 10
166+
(5, 10)
165167
166-
julia> r.state |> size # state shape has changed
167-
(5, 10)
168+
julia> r.state |> size # state shape has changed
169+
(5, 10)
168170
169-
julia> r(rand(Float32, 3)) |> size # erroneously outputs a length 5*10 = 50 vector.
170-
(50,)
171-
```
171+
julia> r(rand(Float32, 3)) |> size # erroneously outputs a length 5*10 = 50 vector.
172+
(50,)
173+
```
172174
"""
173175
RNN(a...; ka...) = Recur(RNNCell(a...; ka...))
174176
Recur(m::RNNCell) = Recur(m, m.state0)
@@ -251,7 +253,8 @@ julia> l(rand(Float32, 3, 10)) |> size # batch size of 10
251253
(5, 10)
252254
```
253255
254-
!!! warning Failing to call `reset!` when the input batch size changes can lead to unexpected behavior. See the example in [`RNN`](@ref).
256+
!!! warning "Batch size changes"
257+
Failing to call `reset!` when the input batch size changes can lead to unexpected behavior. See the example in [`RNN`](@ref).
255258
"""
256259
LSTM(a...; ka...) = Recur(LSTMCell(a...; ka...))
257260
Recur(m::LSTMCell) = Recur(m, m.state0)
@@ -339,7 +342,8 @@ julia> g(rand(Float32, 3, 10)) |> size # batch size of 10
339342
(5, 10)
340343
```
341344
342-
!!! warning Failing to call `reset!` when the input batch size changes can lead to unexpected behavior. See the example in [`RNN`](@ref).
345+
!!! warning "Batch size changes"
346+
Failing to call `reset!` when the input batch size changes can lead to unexpected behavior. See the example in [`RNN`](@ref).
343347
"""
344348
GRU(a...; ka...) = Recur(GRUCell(a...; ka...))
345349
Recur(m::GRUCell) = Recur(m, m.state0)
@@ -416,7 +420,8 @@ julia> g(rand(Float32, 3, 10)) |> size # batch size of 10
416420
(5, 10)
417421
```
418422
419-
!!! warning Failing to call `reset!` when the input batch size changes can lead to unexpected behavior. See the example in [`RNN`](@ref).
423+
!!! warning "Batch size changes"
424+
Failing to call `reset!` when the input batch size changes can lead to unexpected behavior. See the example in [`RNN`](@ref).
420425
"""
421426
GRUv3(a...; ka...) = Recur(GRUv3Cell(a...; ka...))
422427
Recur(m::GRUv3Cell) = Recur(m, m.state0)

0 commit comments

Comments
 (0)