add hack-a-round for language specified markdown code blocks
When language is specified in a markdown code block such as:
````
```c
printf("Hello, world!\n");
```
````
is used, the resulting HTML as produced by `pandoc(1)` combined
with our revised `ioccc.css` is not intent the code block well.
A temporary "_hack-a-round_" is to turn the "markdown code language
specifier" into an HTML comment. For example:
````
```<!---c-->
printf("Hello, world!\n");
```
````
This commits turns off existing markdown code language specifiers
for now, while preserving our ability to restore them in the future
when a better "_hack-a-round_" to the "markdown code language
specifier" problem is found.
The HTML impact if this "_hack-a-round_" is to produce HTML that
looks like this:
```
<pre class="<!---c-->"><code> .. </code></pre>
```
We might be able to create a complex set of classes for each markdown
code language (there won't be very many) in `ioccc.css`, or we might
find a more general CSS (or maybe `pandoc(1)`?) solution.
For now, this hack-a-round will have to do.
This commit is contained in:
1 parent
3919df50fb
commit
b66c79254a
700 files changed
+7052
-7056
No files matched your search
+22
-22
@@ -1,6 +1,6 @@
|
||||
## To build:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
make
|
||||
```
|
||||
|
||||
@@ -18,7 +18,7 @@ For more detailed information see [2019 mills bugs](../../bugs.html#2019_mills).
|
||||
|
||||
## To use:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
make cpclean
|
||||
# Let this run for about about an hour and then kill it:
|
||||
./prog Shakespeare.txt
|
||||
@@ -27,7 +27,7 @@ For more detailed information see [2019 mills bugs](../../bugs.html#2019_mills).
|
||||
|
||||
## Try:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
./try.sh
|
||||
```
|
||||
|
||||
@@ -92,19 +92,19 @@ OMLET has three operating modes:
|
||||
For your first OMLET experiment, we will try training a simple single-level
|
||||
RNN to write some [Shakespeare][5] plays. Start by typing
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
make
|
||||
```
|
||||
|
||||
After it builds, train it using
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
./prog Shakespere.txt
|
||||
```
|
||||
|
||||
This will immediately start outputting gibberish to the output, e.g.
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
./prog Shakespere.txt
|
||||
```
|
||||
|
||||
@@ -259,7 +259,7 @@ doing `Control-C`.
|
||||
You can continue training from a previous checkpoint by providing the
|
||||
checkpoint file name as the second parameter, for example:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
./prog Shakespeare.txt cp01_1.970
|
||||
```
|
||||
|
||||
@@ -275,7 +275,7 @@ parameters to generate data. Inference mode takes the checkpoint file as
|
||||
*standard input* (not on the command line) and hence must be run with a
|
||||
command like
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
./prog < cp55_1.807
|
||||
```
|
||||
|
||||
@@ -294,7 +294,7 @@ The default network for OMLET (the one you get if you type `make` with the
|
||||
executable name `prog`) is the simplest recurrent neural network. It looks
|
||||
like
|
||||
|
||||
```c
|
||||
```<!---c-->
|
||||
h = tanh(Wxh * x + Whh * h' + Bh)
|
||||
y = Why * h + By
|
||||
```
|
||||
@@ -317,26 +317,26 @@ It is the presence of the hidden state vector that allows the RNN to
|
||||
"remember" the past. We can see what would happen if we removed this hidden
|
||||
state. If you type
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
make lin1
|
||||
```
|
||||
|
||||
OMLET will create an [ADALINE][10] network that does
|
||||
|
||||
```c
|
||||
```<!---c-->
|
||||
y = Wxy * x + By
|
||||
```
|
||||
|
||||
This is a simple [linear][11] [feed-forward network][12]. You can run it with
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
./lin1 Shakespeare.txt
|
||||
```
|
||||
|
||||
The linear network won't be able to get past the gibberish stage, because it
|
||||
lacks history:
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
./lin1 Shakespeare.txt
|
||||
```
|
||||
|
||||
@@ -388,7 +388,7 @@ the language but `per` with the digit 1).
|
||||
We can try to improve the RNN's performance by stacking RNN modules atop each
|
||||
other:
|
||||
|
||||
```c
|
||||
```<!---c-->
|
||||
h1 = RNN(h1', x)
|
||||
h2 = RNN(h2', h1)
|
||||
y = Why * h2 + By
|
||||
@@ -414,13 +414,13 @@ the hard limit with `limit -h stacksize` and set it with
|
||||
|
||||
You can try the deeper network by doing
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
make rnn2
|
||||
```
|
||||
|
||||
(or even `make rnn3` if you want a three-layer RNN) and train it with
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
./rnn2 Shakespeare.txt
|
||||
```
|
||||
|
||||
@@ -444,13 +444,13 @@ gradient, worsening the exploding and vanishing gradient problem.
|
||||
solve this problem. Christopher Olah gives a good description of them
|
||||
at his [blog posting][20]. You can build a two-level LSTM by doing
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
make lstm2
|
||||
```
|
||||
|
||||
and train with it with
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
./lstm2 Shakespeare.txt
|
||||
```
|
||||
|
||||
@@ -464,7 +464,7 @@ its hidden state via "gates". These gates are called
|
||||
|
||||
The basic LSTM equations are
|
||||
|
||||
```c
|
||||
```<!---c-->
|
||||
f = sigmoid(Wxf * x + Whf * h' + Bf)
|
||||
i = sigmoid(Wxi * x + Whi * h' + Bi)
|
||||
o = sigmoid(Wxo * x + Who * h' + Bo)
|
||||
@@ -496,7 +496,7 @@ simplified versions of an LSTM which combine the gates together, meaning they
|
||||
require fewer learned parameters. This allows them to train faster than a
|
||||
generic LSTM. You can build a two-layer GRU with
|
||||
|
||||
```sh
|
||||
```<!---sh-->
|
||||
make gru2
|
||||
```
|
||||
|
||||
@@ -510,7 +510,7 @@ compiler's command-line by using `-D` directives. The network is defined by
|
||||
a `-DNW='...'` command which consists of a series of comma-separated
|
||||
assignments. For example, the simple one-layer RNN could be defined like
|
||||
|
||||
```make
|
||||
```<!---make-->
|
||||
-DNW=' x = I(n), hp = I(128), \
|
||||
h = C(hp, T(A(L(128, x), L(128, hp)))), \
|
||||
y = L(n, h)'
|
||||
@@ -555,7 +555,7 @@ training mode, this is used to generate the loss which is backpropagated.
|
||||
As an example of a more complicated network, we can look at a two-layer
|
||||
GRU network:
|
||||
|
||||
```make
|
||||
```<!---make-->
|
||||
-DHS=128, \
|
||||
-DNW=' x = I(n), \
|
||||
y = L(n, MD(MD(x)))' \
|
||||
|
||||
+31
-31
@@ -141,17 +141,17 @@ Location: <a href="../../location.html#US">US</a> - <em>United States of America
|
||||
<!-- START: this line starts content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
|
||||
|
||||
<h2 id="to-build">To build:</h2>
|
||||
<div class="sourceCode" id="cb1"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a> <span class="fu">make</span></span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> make</code></pre>
|
||||
<h3 id="bugs-and-misfeatures">Bugs and (Mis)features:</h3>
|
||||
<p>The current status of this entry is:</p>
|
||||
<pre><code> STATUS: INABIAF - please **DO NOT** fix</code></pre>
|
||||
<p>For more detailed information see <a href="../../bugs.html#2019_mills">2019 mills bugs</a>.</p>
|
||||
<h2 id="to-use">To use:</h2>
|
||||
<div class="sourceCode" id="cb3"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a> <span class="fu">make</span> cpclean</span>
|
||||
<span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a> <span class="co"># Let this run for about about an hour and then kill it:</span></span>
|
||||
<span id="cb3-3"><a href="#cb3-3" aria-hidden="true" tabindex="-1"></a> <span class="ex">./prog</span> Shakespeare.txt</span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> make cpclean
|
||||
# Let this run for about about an hour and then kill it:
|
||||
./prog Shakespeare.txt</code></pre>
|
||||
<h2 id="try">Try:</h2>
|
||||
<div class="sourceCode" id="cb4"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a> <span class="ex">./try.sh</span></span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> ./try.sh</code></pre>
|
||||
<p>However, as the binary model files used to produce the output are in an
|
||||
implementation-specific format, your mileage may vary.</p>
|
||||
<h2 id="judges-remarks">Judges’ remarks:</h2>
|
||||
@@ -200,11 +200,11 @@ training, but you can have even more fun by downloading some larger datasets:</p
|
||||
</ul>
|
||||
<p>For your first OMLET experiment, we will try training a simple single-level
|
||||
RNN to write some <a href="https://en.wikipedia.org/wiki/William_Shakespeare">Shakespeare</a> plays. Start by typing</p>
|
||||
<div class="sourceCode" id="cb5"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a> <span class="fu">make</span></span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> make</code></pre>
|
||||
<p>After it builds, train it using</p>
|
||||
<div class="sourceCode" id="cb6"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a> <span class="ex">./prog</span> Shakespere.txt</span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> ./prog Shakespere.txt</code></pre>
|
||||
<p>This will immediately start outputting gibberish to the output, e.g.</p>
|
||||
<div class="sourceCode" id="cb7"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb7-1"><a href="#cb7-1" aria-hidden="true" tabindex="-1"></a> <span class="ex">./prog</span> Shakespere.txt</span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> ./prog Shakespere.txt</code></pre>
|
||||
<p>produces:</p>
|
||||
<pre><code> sins ohennAu
|
||||
T-teooclelp tiThoWy
|
||||
@@ -331,7 +331,7 @@ helpful if you need to stop and restart training. You can stop training by
|
||||
doing <code>Control-C</code>.</p>
|
||||
<p>You can continue training from a previous checkpoint by providing the
|
||||
checkpoint file name as the second parameter, for example:</p>
|
||||
<div class="sourceCode" id="cb13"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb13-1"><a href="#cb13-1" aria-hidden="true" tabindex="-1"></a> <span class="ex">./prog</span> Shakespeare.txt cp01_1.970</span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> ./prog Shakespeare.txt cp01_1.970</code></pre>
|
||||
<p>After the validation cycle finishes, OMLET begins the next epoch by restarting
|
||||
training at the beginning of the training set. Training continues forever,
|
||||
until you quit it with <code>Control-C</code>. You should monitor the checkpoints to
|
||||
@@ -342,7 +342,7 @@ OMLET to run the network in inference mode which uses the frozen checkpoint
|
||||
parameters to generate data. Inference mode takes the checkpoint file as
|
||||
<em>standard input</em> (not on the command line) and hence must be run with a
|
||||
command like</p>
|
||||
<div class="sourceCode" id="cb14"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb14-1"><a href="#cb14-1" aria-hidden="true" tabindex="-1"></a> <span class="ex">./prog</span> <span class="op"><</span> cp55_1.807</span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> ./prog < cp55_1.807</code></pre>
|
||||
<p>Running it produces an infinite amount of generated output, until you hit
|
||||
<code>Control-C</code> to stop it.</p>
|
||||
<p>Note that if you decide to change networks or use a different input file, you
|
||||
@@ -353,8 +353,8 @@ cause a crash.</p>
|
||||
<p>The default network for OMLET (the one you get if you type <code>make</code> with the
|
||||
executable name <code>prog</code>) is the simplest recurrent neural network. It looks
|
||||
like</p>
|
||||
<div class="sourceCode" id="cb15"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb15-1"><a href="#cb15-1" aria-hidden="true" tabindex="-1"></a> h <span class="op">=</span> tanh<span class="op">(</span>Wxh <span class="op">*</span> x <span class="op">+</span> Whh <span class="op">*</span> h<span class="ch">' </span><span class="er">+ Bh)</span></span>
|
||||
<span id="cb15-2"><a href="#cb15-2" aria-hidden="true" tabindex="-1"></a> y <span class="op">=</span> Why <span class="op">*</span> h <span class="op">+</span> By</span></code></pre></div>
|
||||
<pre class="<!---c-->"><code> h = tanh(Wxh * x + Whh * h' + Bh)
|
||||
y = Why * h + By</code></pre>
|
||||
<p>where</p>
|
||||
<ul>
|
||||
<li><code>x</code> is the <em>input vector</em></li>
|
||||
@@ -371,14 +371,14 @@ the loss of the network across the training set.</p>
|
||||
<p>It is the presence of the hidden state vector that allows the RNN to
|
||||
“remember” the past. We can see what would happen if we removed this hidden
|
||||
state. If you type</p>
|
||||
<div class="sourceCode" id="cb16"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb16-1"><a href="#cb16-1" aria-hidden="true" tabindex="-1"></a> <span class="fu">make</span> lin1</span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> make lin1</code></pre>
|
||||
<p>OMLET will create an <a href="https://en.wikipedia.org/wiki/ADALINE">ADALINE</a> network that does</p>
|
||||
<div class="sourceCode" id="cb17"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb17-1"><a href="#cb17-1" aria-hidden="true" tabindex="-1"></a> y <span class="op">=</span> Wxy <span class="op">*</span> x <span class="op">+</span> By</span></code></pre></div>
|
||||
<pre class="<!---c-->"><code> y = Wxy * x + By</code></pre>
|
||||
<p>This is a simple <a href="https://en.wikipedia.org/wiki/Linear_map">linear</a> <a href="https://en.wikipedia.org/wiki/Feedforward_neural_network">feed-forward network</a>. You can run it with</p>
|
||||
<div class="sourceCode" id="cb18"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb18-1"><a href="#cb18-1" aria-hidden="true" tabindex="-1"></a> <span class="ex">./lin1</span> Shakespeare.txt</span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> ./lin1 Shakespeare.txt</code></pre>
|
||||
<p>The linear network won’t be able to get past the gibberish stage, because it
|
||||
lacks history:</p>
|
||||
<div class="sourceCode" id="cb19"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb19-1"><a href="#cb19-1" aria-hidden="true" tabindex="-1"></a> <span class="ex">./lin1</span> Shakespeare.txt</span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> ./lin1 Shakespeare.txt</code></pre>
|
||||
<p>produces:</p>
|
||||
<pre><code> UERond w,
|
||||
|
||||
@@ -418,9 +418,9 @@ the language but <code>per</code> with the digit 1).</p>
|
||||
<h3 id="going-deeper">Going deeper:</h3>
|
||||
<p>We can try to improve the RNN’s performance by stacking RNN modules atop each
|
||||
other:</p>
|
||||
<div class="sourceCode" id="cb21"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb21-1"><a href="#cb21-1" aria-hidden="true" tabindex="-1"></a> h1 <span class="op">=</span> RNN<span class="op">(</span>h1<span class="ch">',</span><span class="er"> x)</span></span>
|
||||
<span id="cb21-2"><a href="#cb21-2" aria-hidden="true" tabindex="-1"></a> h2 <span class="op">=</span> RNN<span class="op">(</span>h2<span class="ch">',</span><span class="er"> h1)</span></span>
|
||||
<span id="cb21-3"><a href="#cb21-3" aria-hidden="true" tabindex="-1"></a> y <span class="op">=</span> Why <span class="op">*</span> h2 <span class="op">+</span> By</span></code></pre></div>
|
||||
<pre class="<!---c-->"><code> h1 = RNN(h1', x)
|
||||
h2 = RNN(h2', h1)
|
||||
y = Why * h2 + By</code></pre>
|
||||
<p>with <code>RNN(h, x)</code> defined as above. Each RNN module has its own set of
|
||||
parameters and its own hidden state vector. This will improve the network’s
|
||||
performance, at the cost of a much larger parameter space.</p>
|
||||
@@ -436,9 +436,9 @@ the hard limit with <code>limit -h stacksize</code> and set it with
|
||||
<code>limit stacksize 65532</code> (replacing <code>65532</code> with the actual hard limit).</p>
|
||||
<hr />
|
||||
<p>You can try the deeper network by doing</p>
|
||||
<div class="sourceCode" id="cb22"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb22-1"><a href="#cb22-1" aria-hidden="true" tabindex="-1"></a> <span class="fu">make</span> rnn2</span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> make rnn2</code></pre>
|
||||
<p>(or even <code>make rnn3</code> if you want a three-layer RNN) and train it with</p>
|
||||
<div class="sourceCode" id="cb23"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb23-1"><a href="#cb23-1" aria-hidden="true" tabindex="-1"></a> <span class="ex">./rnn2</span> Shakespeare.txt</span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> ./rnn2 Shakespeare.txt</code></pre>
|
||||
<p>The additional depth should allow the network to make better predictions (it
|
||||
can represent more complicated history), but it may take a long time to train
|
||||
-- both because the network (being larger) now requires more time to train and
|
||||
@@ -454,9 +454,9 @@ gradient, worsening the exploding and vanishing gradient problem.</p>
|
||||
<p><a href="https://en.wikipedia.org/wiki/Long_short-term_memory">Long Short Term Memory</a> networks (also called LSTMs) were developed to
|
||||
solve this problem. Christopher Olah gives a good description of them
|
||||
at his <a href="http://colah.github.io/posts/2015-08-Understanding-LSTMs/">blog posting</a>. You can build a two-level LSTM by doing</p>
|
||||
<div class="sourceCode" id="cb24"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb24-1"><a href="#cb24-1" aria-hidden="true" tabindex="-1"></a> <span class="fu">make</span> lstm2</span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> make lstm2</code></pre>
|
||||
<p>and train with it with</p>
|
||||
<div class="sourceCode" id="cb25"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb25-1"><a href="#cb25-1" aria-hidden="true" tabindex="-1"></a> <span class="ex">./lstm2</span> Shakespeare.txt</span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> ./lstm2 Shakespeare.txt</code></pre>
|
||||
<p>The LSTM is much easier to train because it explicitly decides how to update
|
||||
its hidden state via “gates”. These gates are called</p>
|
||||
<ul>
|
||||
@@ -466,11 +466,11 @@ its hidden state via “gates”. These gates are called</p>
|
||||
produce the output</li>
|
||||
</ul>
|
||||
<p>The basic LSTM equations are</p>
|
||||
<div class="sourceCode" id="cb26"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb26-1"><a href="#cb26-1" aria-hidden="true" tabindex="-1"></a> f <span class="op">=</span> sigmoid<span class="op">(</span>Wxf <span class="op">*</span> x <span class="op">+</span> Whf <span class="op">*</span> h<span class="ch">' </span><span class="er">+ Bf)</span></span>
|
||||
<span id="cb26-2"><a href="#cb26-2" aria-hidden="true" tabindex="-1"></a> i <span class="op">=</span> sigmoid<span class="op">(</span>Wxi <span class="op">*</span> x <span class="op">+</span> Whi <span class="op">*</span> h<span class="ch">' </span><span class="er">+ Bi)</span></span>
|
||||
<span id="cb26-3"><a href="#cb26-3" aria-hidden="true" tabindex="-1"></a> o <span class="op">=</span> sigmoid<span class="op">(</span>Wxo <span class="op">*</span> x <span class="op">+</span> Who <span class="op">*</span> h<span class="ch">' </span><span class="er">+ Bo)</span></span>
|
||||
<span id="cb26-4"><a href="#cb26-4" aria-hidden="true" tabindex="-1"></a> c <span class="op">=</span> f <span class="op">*</span> c<span class="ch">' </span><span class="er">+ i * tanh(Wxc * x + Whc * h</span><span class="ch">'</span> <span class="op">+</span> Bc<span class="op">)</span></span>
|
||||
<span id="cb26-5"><a href="#cb26-5" aria-hidden="true" tabindex="-1"></a> h <span class="op">=</span> o <span class="op">*</span> tanh<span class="op">(</span>c<span class="op">)</span></span></code></pre></div>
|
||||
<pre class="<!---c-->"><code> f = sigmoid(Wxf * x + Whf * h' + Bf)
|
||||
i = sigmoid(Wxi * x + Whi * h' + Bi)
|
||||
o = sigmoid(Wxo * x + Who * h' + Bo)
|
||||
c = f * c' + i * tanh(Wxc * x + Whc * h' + Bc)
|
||||
h = o * tanh(c)</code></pre>
|
||||
<p>Where</p>
|
||||
<ul>
|
||||
<li><code>x</code> is the input vector</li>
|
||||
@@ -494,7 +494,7 @@ examples). One important one is the <a href="https://en.wikipedia.org/wiki/Gated
|
||||
simplified versions of an LSTM which combine the gates together, meaning they
|
||||
require fewer learned parameters. This allows them to train faster than a
|
||||
generic LSTM. You can build a two-layer GRU with</p>
|
||||
<div class="sourceCode" id="cb27"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb27-1"><a href="#cb27-1" aria-hidden="true" tabindex="-1"></a> <span class="fu">make</span> gru2</span></code></pre></div>
|
||||
<pre class="<!---sh-->"><code> make gru2</code></pre>
|
||||
<h3 id="building-your-own-networks">Building your own networks</h3>
|
||||
<p>The OMLET <code>Makefile</code> comes with one-, two- and three-layer RNNs, LSTMs and
|
||||
GRUs, along with simpler feed-forward networks like multi-layer perceptrons and
|
||||
@@ -503,7 +503,7 @@ own networks by modifying the <code>Makefile</code>. Networks are passed in on t
|
||||
compiler’s command-line by using <code>-D</code> directives. The network is defined by
|
||||
a <code>-DNW='...'</code> command which consists of a series of comma-separated
|
||||
assignments. For example, the simple one-layer RNN could be defined like</p>
|
||||
<pre class="make"><code> -DNW=' x = I(n), hp = I(128), \
|
||||
<pre class="<!---make-->"><code> -DNW=' x = I(n), hp = I(128), \
|
||||
h = C(hp, T(A(L(128, x), L(128, hp)))), \
|
||||
y = L(n, h)'</code></pre>
|
||||
<p>The network declares <code>x</code> as an input vector (there must be a declaration for
|
||||
@@ -538,7 +538,7 @@ inference mode, this is used to select the next character to emit. In
|
||||
training mode, this is used to generate the loss which is backpropagated.</p>
|
||||
<p>As an example of a more complicated network, we can look at a two-layer
|
||||
GRU network:</p>
|
||||
<pre class="make"><code> -DHS=128, \
|
||||
<pre class="<!---make-->"><code> -DHS=128, \
|
||||
-DNW=' x = I(n), \
|
||||
y = L(n, MD(MD(x)))' \
|
||||
-DBK=' hp = I(HS), \
|
||||
|
||||
Reference in new issue
Block a user