Skip to content

Commit

Permalink
Fix bug in TensorGraph log message
Browse files Browse the repository at this point in the history
  • Loading branch information
drasmuss authored and hunse committed May 14, 2020
1 parent 4536691 commit c73cbee
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ Release history
**Fixed**

- Support Sparse transforms in ``Simulator.get_nengo_params``. (`#149`_)
- Fixed bug in TensorGraph log message when logging was enabled. (`#151`_)

.. _#149: https://github.com/nengo/nengo-dl/pull/149
.. _#151: https://github.com/nengo/nengo-dl/pull/151

3.2.0 (April 2, 2020)
---------------------
Expand Down
2 changes: 1 addition & 1 deletion nengo_dl/tensor_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ def __init__(
logger.info("Optimized plan length: %d", len(self.plan))
logger.info(
"Number of base arrays: (%s, %d), (%s, %d), (%s, %d)",
*tuple((k, len(x)) for k, x in self.base_arrays_init.items()),
*sum(((k, len(x)) for k, x in self.base_arrays_init.items()), ()),
)

def build_inputs(self):
Expand Down
16 changes: 16 additions & 0 deletions nengo_dl/tests/test_simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -1822,3 +1822,19 @@ def test_sim_close(Simulator):
with pytest.raises(SimulatorClosed, match="simulator is closed"):
with sim:
pass


def test_logging(Simulator, caplog):
with nengo.Network() as net:
inp = nengo.Node([0])
ens = nengo.Ensemble(10, 1)
nengo.Connection(inp, ens)
nengo.Probe(ens)

# run a simulation with logging to verify that there are no errors
with caplog.at_level(logging.NOTSET):
with Simulator(net) as sim:
sim.run_steps(10)

for rec in caplog.records:
assert rec.getMessage(), "Record %s has empty message" % rec

0 comments on commit c73cbee

Please sign in to comment.