Skip to content

Commit 99d7079

Browse files
committed
doc fix
1 parent 1993356 commit 99d7079

File tree

1 file changed

+26
-11
lines changed

1 file changed

+26
-11
lines changed

tensorlayer/layers/recurrent.py

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,6 @@ def forward(self, inputs, initial_state=None, **kwargs):
219219
class SimpleRNN(RNN):
220220
"""
221221
The :class:`SimpleRNN` class is a fixed length recurrent layer for implementing simple RNN.
222-
This class is a derived class from :class:`RNN`.
223222
224223
Parameters
225224
----------
@@ -230,19 +229,23 @@ class SimpleRNN(RNN):
230229
- If True, return the last output, "Sequence input and single output"
231230
- If False, return all outputs, "Synced sequence input and output"
232231
- In other word, if you want to stack more RNNs on this layer, set to False
232+
233233
In a dynamic model, `return_last_output` can be updated when it is called in customised forward().
234234
By default, `False`.
235235
return_seq_2d : boolean
236236
Only consider this argument when `return_last_output` is `False`
237237
- If True, return 2D Tensor [batch_size * n_steps, n_hidden], for stacking Dense layer after it.
238238
- If False, return 3D Tensor [batch_size, n_steps, n_hidden], for stacking multiple RNN after it.
239+
239240
In a dynamic model, `return_seq_2d` can be updated when it is called in customised forward().
240241
By default, `False`.
241242
return_last_state: boolean
242243
Whether to return the last state of the RNN cell. The state is a list of Tensor.
243-
For simple RNN, last_state = [last_output];
244+
For simple RNN, last_state = [last_output]
245+
244246
- If True, the layer will return outputs and the final state of the cell.
245247
- If False, the layer will return outputs only.
248+
246249
In a dynamic model, `return_last_state` can be updated when it is called in customised forward().
247250
By default, `False`.
248251
in_channels: int
@@ -251,13 +254,15 @@ class SimpleRNN(RNN):
251254
If None, it will be automatically detected when the layer is forwarded for the first time.
252255
name : str
253256
A unique layer name.
254-
**kwargs:
255-
Advanced arguments to configure the simple RNN cell. Please check tf.keras.layers.SimpleRNNCell.
257+
`**kwargs`:
258+
Advanced arguments to configure the simple RNN cell.
259+
Please check tf.keras.layers.SimpleRNNCell.
256260
257261
Examples
258262
--------
259263
260264
A simple regression model below.
265+
261266
>>> inputs = tl.layers.Input([batch_size, num_steps, embedding_size])
262267
>>> rnn_out, lstm_state = tl.layers.SimpleRNN(
263268
>>> units=hidden_size, dropout=0.1, # both units and dropout are used to configure the simple rnn cell.
@@ -292,7 +297,6 @@ def __init__(
292297
class GRURNN(RNN):
293298
"""
294299
The :class:`GRURNN` class is a fixed length recurrent layer for implementing RNN with GRU cell.
295-
This class is a derived class from :class:`RNN`.
296300
297301
Parameters
298302
----------
@@ -303,19 +307,23 @@ class GRURNN(RNN):
303307
- If True, return the last output, "Sequence input and single output"
304308
- If False, return all outputs, "Synced sequence input and output"
305309
- In other word, if you want to stack more RNNs on this layer, set to False
310+
306311
In a dynamic model, `return_last_output` can be updated when it is called in customised forward().
307312
By default, `False`.
308313
return_seq_2d : boolean
309314
Only consider this argument when `return_last_output` is `False`
310315
- If True, return 2D Tensor [batch_size * n_steps, n_hidden], for stacking Dense layer after it.
311316
- If False, return 3D Tensor [batch_size, n_steps, n_hidden], for stacking multiple RNN after it.
317+
312318
In a dynamic model, `return_seq_2d` can be updated when it is called in customised forward().
313319
By default, `False`.
314320
return_last_state: boolean
315321
Whether to return the last state of the RNN cell. The state is a list of Tensor.
316-
For GRU, last_state = [last_output];
322+
For GRU, last_state = [last_output]
323+
317324
- If True, the layer will return outputs and the final state of the cell.
318325
- If False, the layer will return outputs only.
326+
319327
In a dynamic model, `return_last_state` can be updated when it is called in customised forward().
320328
By default, `False`.
321329
in_channels: int
@@ -324,13 +332,15 @@ class GRURNN(RNN):
324332
If None, it will be automatically detected when the layer is forwarded for the first time.
325333
name : str
326334
A unique layer name.
327-
**kwargs:
328-
Advanced arguments to configure the GRU cell. Please check tf.keras.layers.GRUCell.
335+
`**kwargs`:
336+
Advanced arguments to configure the GRU cell.
337+
Please check tf.keras.layers.GRUCell.
329338
330339
Examples
331340
--------
332341
333342
A simple regression model below.
343+
334344
>>> inputs = tl.layers.Input([batch_size, num_steps, embedding_size])
335345
>>> rnn_out, lstm_state = tl.layers.GRURNN(
336346
>>> units=hidden_size, dropout=0.1, # both units and dropout are used to configure the GRU cell.
@@ -365,7 +375,6 @@ def __init__(
365375
class LSTMRNN(RNN):
366376
"""
367377
The :class:`LSTMRNN` class is a fixed length recurrent layer for implementing RNN with LSTM cell.
368-
This class is a derived class from :class:`RNN`.
369378
370379
Parameters
371380
----------
@@ -376,19 +385,23 @@ class LSTMRNN(RNN):
376385
- If True, return the last output, "Sequence input and single output"
377386
- If False, return all outputs, "Synced sequence input and output"
378387
- In other word, if you want to stack more RNNs on this layer, set to False
388+
379389
In a dynamic model, `return_last_output` can be updated when it is called in customised forward().
380390
By default, `False`.
381391
return_seq_2d : boolean
382392
Only consider this argument when `return_last_output` is `False`
383393
- If True, return 2D Tensor [batch_size * n_steps, n_hidden], for stacking Dense layer after it.
384394
- If False, return 3D Tensor [batch_size, n_steps, n_hidden], for stacking multiple RNN after it.
395+
385396
In a dynamic model, `return_seq_2d` can be updated when it is called in customised forward().
386397
By default, `False`.
387398
return_last_state: boolean
388399
Whether to return the last state of the RNN cell. The state is a list of Tensor.
389400
For LSTM, last_state = [last_output, last_cell_state]
401+
390402
- If True, the layer will return outputs and the final state of the cell.
391403
- If False, the layer will return outputs only.
404+
392405
In a dynamic model, `return_last_state` can be updated when it is called in customised forward().
393406
By default, `False`.
394407
in_channels: int
@@ -397,13 +410,15 @@ class LSTMRNN(RNN):
397410
If None, it will be automatically detected when the layer is forwarded for the first time.
398411
name : str
399412
A unique layer name.
400-
**kwargs:
401-
Advanced arguments to configure the LSTM cell. Please check tf.keras.layers.LSTMCell.
413+
`**kwargs`:
414+
Advanced arguments to configure the LSTM cell.
415+
Please check tf.keras.layers.LSTMCell.
402416
403417
Examples
404418
--------
405419
406420
A simple regression model below.
421+
407422
>>> inputs = tl.layers.Input([batch_size, num_steps, embedding_size])
408423
>>> rnn_out, lstm_state = tl.layers.LSTMRNN(
409424
>>> units=hidden_size, dropout=0.1, # both units and dropout are used to configure the LSTM cell.

0 commit comments

Comments
 (0)