@@ -142,33 +142,35 @@ julia> r(rand(Float32, 3, 10)) |> size # batch size of 10
142
142
(5, 10)
143
143
```
144
144
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:
146
148
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.
153
155
154
- julia> r.state |> size
155
- (5, 1)
156
+ julia> r.state |> size
157
+ (5, 1)
156
158
157
- julia> r(rand(Float32, 3)) |> size
158
- (5,)
159
+ julia> r(rand(Float32, 3)) |> size
160
+ (5,)
159
161
160
- julia> r.state |> size
161
- (5, 1)
162
+ julia> r.state |> size
163
+ (5, 1)
162
164
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)
165
167
166
- julia> r.state |> size # state shape has changed
167
- (5, 10)
168
+ julia> r.state |> size # state shape has changed
169
+ (5, 10)
168
170
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
+ ```
172
174
"""
173
175
RNN (a... ; ka... ) = Recur (RNNCell (a... ; ka... ))
174
176
Recur (m:: RNNCell ) = Recur (m, m. state0)
@@ -251,7 +253,8 @@ julia> l(rand(Float32, 3, 10)) |> size # batch size of 10
251
253
(5, 10)
252
254
```
253
255
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).
255
258
"""
256
259
LSTM (a... ; ka... ) = Recur (LSTMCell (a... ; ka... ))
257
260
Recur (m:: LSTMCell ) = Recur (m, m. state0)
@@ -339,7 +342,8 @@ julia> g(rand(Float32, 3, 10)) |> size # batch size of 10
339
342
(5, 10)
340
343
```
341
344
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).
343
347
"""
344
348
GRU (a... ; ka... ) = Recur (GRUCell (a... ; ka... ))
345
349
Recur (m:: GRUCell ) = Recur (m, m. state0)
@@ -416,7 +420,8 @@ julia> g(rand(Float32, 3, 10)) |> size # batch size of 10
416
420
(5, 10)
417
421
```
418
422
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).
420
425
"""
421
426
GRUv3 (a... ; ka... ) = Recur (GRUv3Cell (a... ; ka... ))
422
427
Recur (m:: GRUv3Cell ) = Recur (m, m. state0)
0 commit comments