Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
astorfi committed Jan 3, 2019
1 parent 92c6e80 commit 2975fb9
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 5 deletions.
Binary file modified docs/build/doctrees/content/documentation.doctree
Binary file not shown.
Binary file modified docs/build/doctrees/environment.pickle
Binary file not shown.
4 changes: 2 additions & 2 deletions docs/build/html/_sources/content/documentation.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -357,8 +357,8 @@ the previously processed sequence. It can be seen in the following Python script


.. code-block:: python
for step_idx in range(args.batch_size):
for step_idx in range(args.batch_size):
# reset the LSTM hidden state. Must be done before you run a new sequence. Otherwise the LSTM will treat
# the new input sequence as a continuation of the previous sequence.
encoder_hidden = encoder.initHidden()
Expand Down
8 changes: 8 additions & 0 deletions docs/build/html/content/documentation.html
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,14 @@ <h2>Training/Evaluation<a class="headerlink" href="#training-evaluation" title="
<p>For mini-batch optimization, we input batches of sequences. There is a very important note for the batch feeding. After
inputing each batch element, the <code class="docutils literal notranslate"><span class="pre">encoder</span> <span class="pre">hidden</span> <span class="pre">states</span></code> must be reset. Otherwise, the system may assume the next sequence in a batch follows
the previously processed sequence. It can be seen in the following Python script:</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="k">for</span> <span class="n">step_idx</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="n">args</span><span class="o">.</span><span class="n">batch_size</span><span class="p">):</span>
<span class="c1"># reset the LSTM hidden state. Must be done before you run a new sequence. Otherwise the LSTM will treat</span>
<span class="c1"># the new input sequence as a continuation of the previous sequence.</span>
<span class="n">encoder_hidden</span> <span class="o">=</span> <span class="n">encoder</span><span class="o">.</span><span class="n">initHidden</span><span class="p">()</span>
<span class="n">input_tensor_step</span> <span class="o">=</span> <span class="n">input_tensor</span><span class="p">[:,</span> <span class="n">step_idx</span><span class="p">][</span><span class="n">input_tensor</span><span class="p">[:,</span> <span class="n">step_idx</span><span class="p">]</span> <span class="o">!=</span> <span class="mi">0</span><span class="p">]</span>
<span class="n">input_length</span> <span class="o">=</span> <span class="n">input_tensor_step</span><span class="o">.</span><span class="n">size</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span>
</pre></div>
</div>
</div>
<div class="section" id="results">
<h2>Results<a class="headerlink" href="#results" title="Permalink to this headline"></a></h2>
Expand Down
2 changes: 1 addition & 1 deletion docs/build/html/searchindex.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions docs/source/content/documentation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -357,8 +357,8 @@ the previously processed sequence. It can be seen in the following Python script


.. code-block:: python
for step_idx in range(args.batch_size):
for step_idx in range(args.batch_size):
# reset the LSTM hidden state. Must be done before you run a new sequence. Otherwise the LSTM will treat
# the new input sequence as a continuation of the previous sequence.
encoder_hidden = encoder.initHidden()
Expand Down

0 comments on commit 2975fb9

Please sign in to comment.