Skip to content

Commit

Permalink
Last update at 2024-06-19 15:54:33
Browse files Browse the repository at this point in the history
  • Loading branch information
NengoBones committed Jun 19, 2024
1 parent c684578 commit 16b72db
Show file tree
Hide file tree
Showing 54 changed files with 14,101 additions and 7,843 deletions.
2 changes: 1 addition & 1 deletion .buildinfo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: af2f8f4e454a9fab8caa1368ea3e6801
config: ba8ea9ec9ec10ef9096dd3afae52f083
tags: 645f666f9bcd5a90fca523b33c5a78b7
Binary file modified .doctrees/api-reference.doctree
Binary file not shown.
Binary file modified .doctrees/basic-usage.doctree
Binary file not shown.
Binary file modified .doctrees/changelog.doctree
Binary file not shown.
Binary file modified .doctrees/citation.doctree
Binary file not shown.
Binary file modified .doctrees/contributing.doctree
Binary file not shown.
Binary file modified .doctrees/environment.pickle
Binary file not shown.
Binary file modified .doctrees/examples.doctree
Binary file not shown.
Binary file modified .doctrees/examples/psMNIST.doctree
Binary file not shown.
Binary file modified .doctrees/getting-started.doctree
Binary file not shown.
Binary file modified .doctrees/index.doctree
Binary file not shown.
Binary file modified .doctrees/license.doctree
Binary file not shown.
2,830 changes: 154 additions & 2,676 deletions .doctrees/nbsphinx/examples/psMNIST.ipynb

Large diffs are not rendered by default.

Binary file modified .doctrees/nbsphinx/examples_psMNIST_11_0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .doctrees/nbsphinx/examples_psMNIST_13_0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .doctrees/nbsphinx/examples_psMNIST_23_0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .doctrees/nbsphinx/examples_psMNIST_9_0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .doctrees/project.doctree
Binary file not shown.
127 changes: 34 additions & 93 deletions 404.html
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@

<!DOCTYPE html>

<html>
<html lang="en" data-content_root="./">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Page not found &#8212; KerasLMU 0.7.0 docs</title>
<link rel="stylesheet" href="/keras-lmu/_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="/keras-lmu/_static/basic.css" type="text/css" />
<link rel="stylesheet" type="text/css" href="/keras-lmu/_static/nbsphinx-code-cells.css" />
<title>Page not found &#8212; KerasLMU 0.8.0.dev0 docs</title>
<link rel="stylesheet" type="text/css" href="/keras-lmu/_static/pygments.css?v=fa44fd50" />
<link rel="stylesheet" type="text/css" href="/keras-lmu/_static/basic.css?v=fb9458d3" />
<link rel="stylesheet" type="text/css" href="/keras-lmu/_static/nengo.css?v=1e9b7ed3" />
<link rel="preconnect" href="https://fonts.googleapis.com"/>
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin/>
<link href="https://fonts.googleapis.com/css2?family=DM+Sans:ital,wght@0,400;0,500;0,700;1,400;1,500;1,700&family=Space+Grotesk:wght@400;700&display=swap" rel="stylesheet" />
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.2/css/all.css" integrity="sha384-oS3vJWv+0UjzBfQzYUhtDYW+Pj2yciDJxpsK1OYPAYjqT085Qq/1cq5FLXAZQ7Ay" crossorigin="anonymous">
<link rel="stylesheet" href="https://www.nengo.ai/css/bootstrap.css" type="text/css">
<style>
body .title-bar,
body .documentation-source h1:after {
Expand All @@ -28,11 +26,13 @@
<!-- From basic/layout.html -->
<script type="text/javascript" id="documentation_options" data-url_root="#" src="/keras-lmu/_static/documentation_options.js"></script>

<script src="/keras-lmu/_static/documentation_options.js?v=ba145e45"></script>


<script src="/keras-lmu/_static/underscore.js"></script>
<script src="/keras-lmu/_static/doctools.js?v=9a2dae69"></script>


<script src="/keras-lmu/_static/doctools.js"></script>
<script src="/keras-lmu/_static/sphinx_highlight.js?v=dc90522c"></script>


<script crossorigin="anonymous" integrity="sha256-Ae2Vz/4ePdIu6ZyI/5ZGsYnb+m0JlOmKPjt6XZ9JJkA=" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.4/require.min.js"></script>
Expand All @@ -51,7 +51,7 @@
var _paq = window._paq = window._paq || [];
_paq.push(["setDocumentTitle", document.domain + "/" + document.title]);
_paq.push(["setCookieDomain", "*.appliedbrainresearch.com"]);
_paq.push(["setDomains", ["*.appliedbrainresearch.com","*.edge.nengo.ai","*.forum.nengo.ai","*.labs.nengo.ai","*.nengo.ai"]]);
_paq.push(["setDomains", ["*.appliedbrainresearch.com","*.edge.nengo.ai","*.forum.nengo.ai","*.nengo.ai"]]);
_paq.push(["enableCrossDomainLinking"]);
_paq.push(["setDoNotTrack", true]);
_paq.push(['trackPageView']);
Expand All @@ -66,31 +66,21 @@
</script>
<!-- End Matomo Code -->

<link rel="shortcut icon" href="/keras-lmu/_static/favicon.ico"/>
<link rel="icon" href="/keras-lmu/_static/favicon.ico"/>
<link rel="index" title="Index" href="/keras-lmu/genindex.html" />
<link rel="search" title="Search" href="/keras-lmu/search.html" />
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">

</head><body class="bg-dark">
</head><body class="bg-dark"><!-- prettier-ignore -->


<header class="fixed-top header-top shadow-sm">
<nav class="navbar navbar-expand-md navbar-light bg-white">
<a class="navbar-brand" href="https://www.nengo.ai/">
<img
src="https://www.nengo.ai/design/_images/general-full-light.svg"
alt="Nengo"
class="logo"
/>
<img src="https://www.nengo.ai/design/_images/general-full-light.svg" alt="Nengo" class="logo" />
</a>
<button
class="navbar-toggler"
type="button"
data-toggle="collapse"
data-target="#navbar-collapse"
aria-controls="navbar-collapse"
aria-expanded="false"
aria-label="Toggle navigation"
>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbar-collapse"
aria-controls="navbar-collapse" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbar-collapse">
Expand All @@ -102,19 +92,9 @@
<a class="nav-link" href="https://www.nengo.ai/examples/">Examples</a>
</li>
<li class="nav-item dropdown active">
<a
class="nav-link dropdown-toggle text-nowrap"
id="navbar-dropdown-docs"
data-toggle="dropdown"
aria-haspopup="true"
aria-expanded="false"
href="#"
>Documentation</a
>
<div
class="dropdown-menu shadow-lg border-0"
aria-labelledby="navbar-dropdown-docs"
>
<a class="nav-link dropdown-toggle text-nowrap" id="navbar-dropdown-docs" data-toggle="dropdown"
aria-haspopup="true" aria-expanded="false" href="#">Documentation</a>
<div class="dropdown-menu shadow-lg border-0" aria-labelledby="navbar-dropdown-docs">

<a class="dropdown-item" href="https://www.nengo.ai/nengo/">Nengo core</a>
<a class="dropdown-item" href="https://github.com/nengo/nengo-gui/">NengoGUI</a>
Expand All @@ -128,67 +108,33 @@
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="https://www.nengo.ai/nengo-fpga/">NengoFPGA</a>
<a class="dropdown-item" href="https://www.nengo.ai/nengo-loihi/">NengoLoihi</a>
<a class="dropdown-item" href="https://labs.nengo.ai/nengo-ocl/">NengoOCL</a>
<a class="dropdown-item" href="https://www.nengo.ai/nengo-ocl/">NengoOCL</a>
<a class="dropdown-item" href="https://github.com/project-rig/nengo_spinnaker">NengoSpiNNaker</a>
<a class="dropdown-item" href="https://github.com/nengo-labs/nengo-mpi">NengoMPI</a>
<a class="dropdown-item" href="https://github.com/nengo/nengo-mpi">NengoMPI</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="https://www.nengo.ai/documentation/"
>All documentation</a
>
<a class="dropdown-item" href="https://www.nengo.ai/documentation/">All documentation</a>
</div>
</li>
<li class="nav-item dropdown">
<a
class="nav-link dropdown-toggle text-nowrap"
id="navbar-dropdown-community"
data-toggle="dropdown"
aria-haspopup="true"
aria-expanded="false"
href="#"
>Community</a
>
<div
class="dropdown-menu shadow-lg border-0"
aria-labelledby="navbar-dropdown-community"
>
<a class="nav-link dropdown-toggle text-nowrap" id="navbar-dropdown-community" data-toggle="dropdown"
aria-haspopup="true" aria-expanded="false" href="#">Community</a>
<div class="dropdown-menu shadow-lg border-0" aria-labelledby="navbar-dropdown-community">
<a class="dropdown-item" href="https://forum.nengo.ai">Forum</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="https://www.nengo.ai/people/"
>People</a
>
<a class="dropdown-item" href="https://www.nengo.ai/summer-school/"
>Summer school</a
>
<a class="dropdown-item" href="https://www.nengo.ai/contributing/"
>Contributing</a
>
<a class="dropdown-item" href="https://www.nengo.ai/publications/"
>Publications</a
>
<a class="dropdown-item" href="https://www.nengo.ai/videos/"
>Videos</a
>
<a class="dropdown-item" href="https://www.nengo.ai/conduct/"
>Code of conduct</a
>
<a class="dropdown-item" href="https://www.nengo.ai/people/">People</a>
<a class="dropdown-item" href="https://www.nengo.ai/summer-school/">Summer school</a>
<a class="dropdown-item" href="https://www.nengo.ai/contributing/">Contributing</a>
<a class="dropdown-item" href="https://www.nengo.ai/publications/">Publications</a>
<a class="dropdown-item" href="https://www.nengo.ai/videos/">Videos</a>
<a class="dropdown-item" href="https://www.nengo.ai/conduct/">Code of conduct</a>
<a class="dropdown-item" href="https://www.nengo.ai/caa/">CAA</a>
</div>
</li>
</ul>
<ul class="navbar-nav ml-auto">
<li class="nav-item">
<a
class="nav-link btn btn-success btn-sm text-white"
href="https://www.nengo.ai/getting-started/"
>Getting started</a
>
</li>
<li class="nav-item">
<a
class="nav-link btn btn-success btn-sm text-white"
href="https://www.nengo.ai/store/"
>Store</a
>
<a class="nav-link btn btn-success btn-sm text-white" href="https://www.nengo.ai/getting-started/">Getting
started</a>
</li>
</ul>
</div>
Expand Down Expand Up @@ -341,16 +287,11 @@ <h3 class="display-2">Error <strong>404</strong></h3>
</div><footer class="text-light footer-main gradient-bottom-center">
<p class="text-center">
<a class="no-hover-line" href="https://appliedbrainresearch.com">
<img
class="abr-logo"
src="https://www.nengo.ai/img/abr-logo.svg"
height="32"
/>
<img class="abr-logo" src="https://www.nengo.ai/img/abr-logo.svg" height="32" />
</a>
<a href="https://www.nengo.ai/">What is Nengo?</a>
<a href="https://www.nengo.ai/examples/">Examples</a>
<a href="https://www.nengo.ai/documentation/">Documentation</a>
<a href="https://www.nengo.ai/store/">Store</a>
<a href="https://www.nengo.ai/getting-started/">Getting started</a>
<a href="https://www.nengo.ai/privacy/">Privacy</a>
</p>
Expand Down
Binary file modified _images/examples_psMNIST_11_0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified _images/examples_psMNIST_13_0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified _images/examples_psMNIST_23_0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified _images/examples_psMNIST_9_0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 5 additions & 7 deletions _sources/basic-usage.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@ a new LMU layer:

.. testcode::

import keras
import keras_lmu

lmu_layer = keras_lmu.LMU(
memory_d=1,
order=256,
theta=784,
hidden_cell=tf.keras.layers.SimpleRNNCell(units=10),
hidden_cell=keras.layers.SimpleRNNCell(units=10),
)

Note that the values used above for ``memory_d``, ``order``,
Expand All @@ -40,14 +41,11 @@ a 10-dimensional input and a 20-dimensional output.

.. testcode::

from tensorflow.keras import Input, Model
from tensorflow.keras.layers import Dense

inputs = Input((None, 10))
inputs = keras.Input((None, 10))
lmus = lmu_layer(inputs)
outputs = Dense(20)(lmus)
outputs = keras.layers.Dense(20)(lmus)

model = Model(inputs=inputs, outputs=outputs)
model = keras.Model(inputs=inputs, outputs=outputs)


Other parameters
Expand Down
30 changes: 16 additions & 14 deletions _sources/examples/psMNIST.ipynb.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"source": [
"%matplotlib inline\n",
"\n",
"import keras\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"from IPython.display import Image, display\n",
Expand Down Expand Up @@ -81,9 +82,7 @@
{
"cell_type": "markdown",
"metadata": {},
"source": [
"We now obtain the standard MNIST dataset of handwritten digits from `tf.keras.datasets`."
]
"source": "We now obtain the standard MNIST dataset of handwritten digits from `keras.datasets`."
},
{
"cell_type": "code",
Expand All @@ -94,7 +93,7 @@
"(train_images, train_labels), (\n",
" test_images,\n",
" test_labels,\n",
") = tf.keras.datasets.mnist.load_data()"
") = keras.datasets.mnist.load_data()"
]
},
{
Expand Down Expand Up @@ -261,22 +260,22 @@
" memory_d=1,\n",
" order=256,\n",
" theta=n_pixels,\n",
" hidden_cell=tf.keras.layers.SimpleRNNCell(212),\n",
" hidden_cell=keras.layers.SimpleRNNCell(212),\n",
" hidden_to_memory=False,\n",
" memory_to_memory=False,\n",
" input_to_hidden=True,\n",
" kernel_initializer=\"ones\",\n",
")\n",
"\n",
"# TensorFlow layer definition\n",
"inputs = tf.keras.Input((n_pixels, 1))\n",
"inputs = keras.Input((n_pixels, 1))\n",
"lmus = lmu_layer(inputs)\n",
"outputs = tf.keras.layers.Dense(10)(lmus)\n",
"outputs = keras.layers.Dense(10)(lmus)\n",
"\n",
"# TensorFlow model definition\n",
"model = tf.keras.Model(inputs=inputs, outputs=outputs)\n",
"model = keras.Model(inputs=inputs, outputs=outputs)\n",
"model.compile(\n",
" loss=tf.keras.losses.SparseCategoricalCrossentropy(from_logits=True),\n",
" loss=keras.losses.SparseCategoricalCrossentropy(from_logits=True),\n",
" optimizer=\"adam\",\n",
" metrics=[\"accuracy\"],\n",
")\n",
Expand Down Expand Up @@ -316,10 +315,13 @@
"batch_size = 100\n",
"epochs = 10\n",
"\n",
"saved_weights_fname = \"./psMNIST-weights.hdf5\"\n",
"saved_model_fname = \"./psMNIST.keras\"\n",
"callbacks = [\n",
" tf.keras.callbacks.ModelCheckpoint(\n",
" filepath=saved_weights_fname, monitor=\"val_loss\", verbose=1, save_best_only=True\n",
" keras.callbacks.ModelCheckpoint(\n",
" filepath=saved_model_fname,\n",
" monitor=\"val_accuracy\",\n",
" verbose=1,\n",
" save_best_only=True,\n",
" ),\n",
"]\n",
"\n",
Expand Down Expand Up @@ -393,8 +395,8 @@
"metadata": {},
"outputs": [],
"source": [
"model.load_weights(saved_weights_fname)\n",
"accuracy = model.evaluate(X_test, Y_test)[1] * 100\n",
"model.load_weights(saved_model_fname)\n",
"accuracy = model.evaluate(X_test, Y_test, verbose=0)[1] * 100\n",
"print(f\"Test accuracy: {round(accuracy, 2):0.2f}%\")"
]
},
Expand Down
Loading

0 comments on commit 16b72db

Please sign in to comment.