Skip to content

Commit

Permalink
Updates to match changes in Nengo
Browse files Browse the repository at this point in the history
- Fixes #42, #43
- No more nengo.compat
  - Use configparser directly
  - Use nengo.utils.numpy.is_array_like
- Add new state arg to make_step
- Start using native logger instead of nengo logger in examples
- Update requirements to nengo>=3.0.0
- Update nengo urls to us '-' instead of '_'
  • Loading branch information
bmorcos committed Nov 26, 2019
1 parent a32cd93 commit d21c672
Show file tree
Hide file tree
Showing 14 changed files with 32 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .nengobones.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ setup_py:
nengo.backends:
- fpga = nengo_fpga:Simulator
install_req:
- nengo>=2.8.0
- nengo>=3.0.0
- numpy>=1.13.0,<1.17
- paramiko>=2.4.1
docs_req:
Expand Down
6 changes: 5 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,16 @@ Release History
- Setup Nengo Bones and remote CI.
(`#41 <https://github.com/nengo/nengo-fpga/pull/41>`__)

**Changed**

- Compatibility changes for Nengo 3.0.0.
(`#44 <https://github.com/nengo/nengo-fpga/pull/44>`__)

**Fixed**

- Fixed code to remove all linter errors.
(`#45 <https://github.com/nengo/nengo-fpga/pull/45>`__)


0.2.1 (September 17, 2019)
--------------------------

Expand Down
8 changes: 4 additions & 4 deletions docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,17 @@ If a recurrent connection exists, we can similarly modify that connection:
.. seealso::
Check out the Nengo documentation for a full list of `ensemble parameters
<https://www.nengo.ai/nengo/frontend_api.html#nengo.Ensemble>`_ and
`connection parameter <https://www.nengo.ai/nengo/frontend_api.html#nengo.Connection>`_.
<https://www.nengo.ai/nengo/frontend-api.html#nengo.Ensemble>`_ and
`connection parameter <https://www.nengo.ai/nengo/frontend-api.html#nengo.Connection>`_.


Supported Neuron Types
======================

Currently NengoFPGA supports the following neuron types:

- `nengo.RecitifiedLinear <https://www.nengo.ai/nengo/frontend_api.html#nengo.RectifiedLinear>`_
- `nengo.SpikingRectifiedLinear <https://www.nengo.ai/nengo/frontend_api.html#nengo.SpikingRectifiedLinear>`_
- `nengo.RecitifiedLinear <https://www.nengo.ai/nengo/frontend-api.html#nengo.RectifiedLinear>`_
- `nengo.SpikingRectifiedLinear <https://www.nengo.ai/nengo/frontend-api.html#nengo.SpikingRectifiedLinear>`_


Objects and Functions
Expand Down
3 changes: 2 additions & 1 deletion docs/examples/basic_example.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import argparse
import logging
import numpy as np

import nengo
Expand All @@ -22,7 +23,7 @@

# Set the nengo logging level to 'info' to display all of the information
# coming back over the ssh connection.
nengo.utils.logging.log("info")
logging.basicConfig(format="%(levelname)s:%(message)s", level=logging.INFO)

parser = argparse.ArgumentParser(
description="A simple communication channel example showing how to"
Expand Down
3 changes: 2 additions & 1 deletion docs/examples/gui/00-mnist_vision_network.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import logging
import numpy as np
import nengo

Expand Down Expand Up @@ -39,7 +40,7 @@ def one_hot(labels, c=None):

# Set the nengo logging level to 'info' to display all of the information
# coming back over the ssh connection.
nengo.utils.logging.log("info")
logging.basicConfig(format="%(levelname)s:%(message)s", level=logging.INFO)

# Set the rng state (using a fixed seed that works)
rng = np.random.RandomState(9)
Expand Down
7 changes: 5 additions & 2 deletions docs/examples/gui/01-adaptive_pendulum.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import logging
import numpy as np

import nengo
Expand All @@ -6,7 +7,7 @@

# Set the nengo logging level to 'info' to display all of the information
# coming back over the ssh connection.
nengo.utils.logging.log("info")
logging.basicConfig(format="%(levelname)s:%(message)s", level=logging.INFO)

# ---------------- BOARD SELECT ----------------------- #
# Change this to your desired device name
Expand Down Expand Up @@ -75,7 +76,9 @@ def generate_html(self, desired):
<line x1="{x1}" y1="{y1}" x2="{x3}" y2="{y3}" style="stroke:blue"/>
<line x1="{x1}" y1="{y1}" x2="{x2}" y2="{y2}" style="stroke:black"/>
</svg>
""".format(x1=x1, y1=y1, x2=x2, y2=y2, x3=x3, y3=y3)
""".format(
x1=x1, y1=y1, x2=x2, y2=y2, x3=x3, y3=y3
)


class PendulumNetwork(nengo.Network):
Expand Down
3 changes: 2 additions & 1 deletion docs/examples/gui/02-RL_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
# to do actions that will lead to *future* rewards.

import time
import logging
import numpy as np

import nengo
Expand All @@ -37,7 +38,7 @@

# Set the nengo logging level to 'info' to display all of the information
# coming back over the ssh connection.
nengo.utils.logging.log("info")
logging.basicConfig(format="%(levelname)s:%(message)s", level=logging.INFO)

# ---------------- BOARD SELECT ----------------------- #
# Change this to your desired device name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@
"source": [
"## How Does This Work?\n",
"\n",
"Since many of the internal dynamics of the FPGA ensemble are not probable (for sake of performance), it is difficult to explore the details of the implementation here. Take a look at the [learn_communication_channel](https://www.nengo.ai/nengo/examples/learning/learn_communication_channel.html#How-does-this-work?)\n",
"Since many of the internal dynamics of the FPGA ensemble are not probable (for sake of performance), it is difficult to explore the details of the implementation here. Take a look at the [learn_communication_channel](https://www.nengo.ai/nengo/examples/learning/learn-communication-channel.html#How-does-this-work?)\n",
"example built with standard Nengo for an explanation of the learning rule and how the connection weights changes as the learning rule is applied."
]
}
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/notebooks/02-set_neuron_params.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
"\n",
"Use these two objects to set specific attributes as desired.\n",
"Please look at the Nengo documentation for\n",
"[Ensembles](https://www.nengo.ai/nengo/frontend_api.html#nengo.Ensemble) and\n",
"[Connections](https://www.nengo.ai/nengo/frontend_api.html#nengo.Connection)\n",
"[Ensembles](https://www.nengo.ai/nengo/frontend-api.html#nengo.Ensemble) and\n",
"[Connections](https://www.nengo.ai/nengo/frontend-api.html#nengo.Connection)\n",
"for a full list of options.\n",
"\n",
"## Step 1: Set up Python Imports"
Expand Down
2 changes: 1 addition & 1 deletion docs/getting_started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Getting Started
Things You Need
===============

- `Nengo <https://www.nengo.ai/nengo/getting_started.html>`_
- `Nengo <https://www.nengo.ai/nengo/getting-started.html>`_
- A :ref:`supported FPGA board <supported-hardware>`
- A NengoFPGA Licence (available from `Applied Brain Research <https://store.appliedbrainresearch.com/collections/nengo-fpga>`_)
- (Optional) `Nengo GUI <https://github.com/nengo/nengo-gui>`_
Expand Down
2 changes: 1 addition & 1 deletion nengo_fpga/fpga_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import logging

from nengo.utils.compat import configparser
import configparser
import nengo_fpga.utils.paths

logger = logging.getLogger(__name__)
Expand Down
4 changes: 2 additions & 2 deletions nengo_fpga/networks/fpga_pes_ensemble_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ def __init__(
self.get_output_dim(function, dimensions)

# Process feedback connection
if nengo.utils.compat.is_array_like(feedback):
if nengo.utils.numpy.is_array_like(feedback):
self.rec_transform = feedback
elif feedback is not None:
raise nengo.exceptions.ValidationError(
Expand Down Expand Up @@ -247,7 +247,7 @@ def get_output_dim(self, function, dimensions):
self.output_dimensions = dimensions
elif callable(function):
self.output_dimensions = len(function(np.zeros(dimensions)))
elif nengo.utils.compat.is_array_like(function):
elif nengo.utils.numpy.is_array_like(function):
self.output_dimensions = function.shape[1]
else:
raise nengo.exceptions.ValidationError(
Expand Down
6 changes: 3 additions & 3 deletions nengo_fpga/sockets.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ def __init__(
self.byte_order = byte_order
self.recv = None

def make_step(self, shape_in, shape_out, dt, rng):
def make_step(self, shape_in, shape_out, dt, rng, _):
"""Socket integration into Nengo simulator"""
assert len(shape_out) == 1
self.recv = _UDPSocket(
Expand Down Expand Up @@ -465,7 +465,7 @@ def __init__(self, remote_addr, remote_dt=None, byte_order="="):
self.byte_order = byte_order
self.send = None

def make_step(self, shape_in, shape_out, dt, rng):
def make_step(self, shape_in, shape_out, dt, rng, _):
"""Socket integration into Nengo simulator"""
assert len(shape_in) == 1
self.send = _UDPSocket(self.remote_addr, shape_in[0], self.byte_order)
Expand Down Expand Up @@ -575,7 +575,7 @@ def __init__(
self.recv = None
self.send = None

def make_step(self, shape_in, shape_out, dt, rng):
def make_step(self, shape_in, shape_out, dt, rng, _):
"""Socket integration into Nengo simulator"""
assert len(shape_in) == 1
assert len(shape_out) == 1
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def read(*filenames, **kwargs):
version = runpy.run_path(os.path.join(root, "nengo_fpga", "version.py"))["version"]

install_req = [
"nengo>=2.8.0",
"nengo>=3.0.0",
"numpy>=1.13.0,<1.17",
"paramiko>=2.4.1",
]
Expand Down

0 comments on commit d21c672

Please # to comment.