Skip to content

Commit

Permalink
Merge pull request #3104 from keisuke-umezawa/improve-docs-of-lstm-link
Browse files Browse the repository at this point in the history
Improve docs of links/connection/lstm
  • Loading branch information
mitmul committed Aug 23, 2017
2 parents 69be927 + 430f5cb commit c68e62a
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions chainer/links/connection/lstm.py
Expand Up @@ -199,6 +199,34 @@ class LSTM(LSTMBase):
c (~chainer.Variable): Cell states of LSTM units.
h (~chainer.Variable): Output at the previous time step.
.. admonition:: Example
There are several ways to make a LSTM link.
Let a two-dimensional input array :math:`x` be:
>>> x = np.zeros((1, 10), dtype='f')
1. Give both ``in_size`` and ``out_size`` arguments:
>>> l = L.LSTM(10, 20)
>>> h_new = l(x)
>>> h_new.shape
(1, 20)
2. Omit ``in_size`` argument or fill it with ``None``:
The below two cases are the same.
>>> l = L.LSTM(20)
>>> h_new = l(x)
>>> h_new.shape
(1, 20)
>>> l = L.LSTM(None, 20)
>>> h_new = l(x)
>>> h_new.shape
(1, 20)
"""

def __init__(self, in_size, out_size=None, **kwargs):
Expand Down

0 comments on commit c68e62a

Please sign in to comment.