Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More memory optimizations #129

Merged
merged 5 commits into from
Mar 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ Release history
- Added ``nengo_dl.LeakyReLU`` and ``nengo_dl.SpikingLeakyReLU`` neuron models.
(`#126`_)
- Added support for leaky ReLU Keras layers to ``nengo_dl.Converter``. (`#126`_)
- Added a new ``remove_reset_incs`` graph simplification step. (`#129`_)

**Changed**

Expand All @@ -52,6 +53,10 @@ Release history
(see `Nengo#1591`_). Note that this may change the number of trainable
parameters in a network as the scalar default ``transform=1`` weights on
non-Ensemble connections will no longer be present. (`#128`_)
- Re-enabled the ``remove_constant_copies`` graph simplification by default. (`#129`_)
- Reduced the amount of state that needs to be stored in the simulation. (`#129`_)
- Added more information to the error message when loading saved parameters that
don't match the current model. (`#129`_)

**Fixed**

Expand All @@ -68,6 +73,7 @@ Release history
.. _#119: https://github.com/nengo/nengo-dl/pull/119
.. _#126: https://github.com/nengo/nengo-dl/pull/126
.. _#128: https://github.com/nengo/nengo-dl/pull/128
.. _#129: https://github.com/nengo/nengo-dl/pull/129
.. _#136: https://github.com/nengo/nengo-dl/pull/136
.. _Nengo#1591: https://github.com/nengo/nengo/pull/1591

Expand Down
2 changes: 2 additions & 0 deletions docs/config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,8 @@ disable sorting via
with nengo.Network() as net:
nengo_dl.configure_settings(sorter=noop_order_signals)

.. _config-simplifications:
tbekolay marked this conversation as resolved.
Show resolved Hide resolved

simplifications
---------------

Expand Down
2 changes: 1 addition & 1 deletion docs/examples/spa-memory.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@
" # download pretrained parameters\n",
" urlretrieve(\n",
" \"https://drive.google.com/uc?export=download&\"\n",
" \"id=182toR0aSWv1uExA7F5kn8t2lEU1SVrx1\",\n",
" \"id=1aspi_dayS37Rx_IvDuRrXoybdIC_-tkn\",\n",
" \"mem_binding_params.npz\")"
]
},
Expand Down
8 changes: 5 additions & 3 deletions nengo_dl/benchmarks.py
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,7 @@ def run_profile(
sim.minibatch_size * n_batches, n_steps, net.inp.size_out
)
}
else:
elif hasattr(net, "inp_a"):
x = {
net.inp_a: np.random.randn(
sim.minibatch_size * n_batches, n_steps, net.inp_a.size_out
Expand All @@ -658,6 +658,8 @@ def run_profile(
sim.minibatch_size * n_batches, n_steps, net.inp_b.size_out
),
}
else:
x = None

if train:
y = {
Expand All @@ -670,14 +672,14 @@ def run_profile(

# run once to eliminate startup overhead
start = timeit.default_timer()
sim.fit(x, y, epochs=1)
sim.fit(x, y, epochs=1, n_steps=n_steps)
print("Warmup time:", timeit.default_timer() - start)

for _ in range(reps):
if do_profile:
profiler.start()
start = timeit.default_timer()
sim.fit(x, y, epochs=1)
sim.fit(x, y, epochs=1, n_steps=n_steps)
exec_time = min(timeit.default_timer() - start, exec_time)
if do_profile:
profiler.save("profile", profiler.stop())
Expand Down
3 changes: 2 additions & 1 deletion nengo_dl/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ def configure_settings(**kwargs):
simplifications: list of graph simplification functions
Pass a list of `graph simplification functions
<https://www.nengo.ai/nengo-dl/reference.html#graph-optimization>`_ to change
the default simplifications applied.
the default simplifications applied. The default list of simplifications
can be found in ``nengo_dl.graph_optimizer.default_simplifications``.
inference_only : bool
Set to True if the network will only be run in inference mode (i.e.,
no calls to `.Simulator.fit`). This may result in a small
Expand Down
Loading