Comments (4)
It's not an identity connection (pre size != post size), so you can't use a scalar, you have to specify a full matrix. There's a separate issue of whether we want to allow Choice([0])
on identity connections, but that's an issue for nengo core (either one would work fine with freeze_params
in NengoDL).
from nengo-dl.
Note: I also get a similar error when saving the params from transform = nengo.dists.Choice([0])
and then trying to load them into a model with transform = np.zeros((n_neurons, 1))
:
----> 5 sim.keras_model.load_weights(fname)
6 sim.freeze_params(net)
~/anaconda3/envs/nengo-dl/lib/python3.7/site-packages/tensorflow_core/python/keras/engine/training.py in load_weights(self, filepath, by_name)
179 raise ValueError('Load weights is not yet supported with TPUStrategy '
180 'with steps_per_run greater than 1.')
--> 181 return super(Model, self).load_weights(filepath, by_name)
182
183 @trackable.no_automatic_dependency_tracking
~/anaconda3/envs/nengo-dl/lib/python3.7/site-packages/tensorflow_core/python/keras/engine/network.py in load_weights(self, filepath, by_name)
1175 saving.load_weights_from_hdf5_group_by_name(f, self.layers)
1176 else:
-> 1177 saving.load_weights_from_hdf5_group(f, self.layers)
1178
1179 def _updated_config(self):
~/anaconda3/envs/nengo-dl/lib/python3.7/site-packages/tensorflow_core/python/keras/saving/hdf5_format.py in load_weights_from_hdf5_group(f, layers)
697 str(len(weight_values)) + ' elements.')
698 weight_value_tuples += zip(symbolic_weights, weight_values)
--> 699 K.batch_set_value(weight_value_tuples)
700
701
~/anaconda3/envs/nengo-dl/lib/python3.7/site-packages/tensorflow_core/python/keras/backend.py in batch_set_value(tuples)
3356 assign_placeholder = array_ops.placeholder(tf_dtype,
3357 shape=value.shape)
-> 3358 assign_op = x.assign(assign_placeholder)
3359 x._assign_placeholder = assign_placeholder
3360 x._assign_op = assign_op
~/anaconda3/envs/nengo-dl/lib/python3.7/site-packages/tensorflow_core/python/ops/resource_variable_ops.py in assign(self, value, use_locking, name, read_value)
812 with _handle_graph(self.handle):
813 value_tensor = ops.convert_to_tensor(value, dtype=self.dtype)
--> 814 self._shape.assert_is_compatible_with(value_tensor.shape)
815 assign_op = gen_resource_variable_ops.assign_variable_op(
816 self.handle, value_tensor, name=name)
~/anaconda3/envs/nengo-dl/lib/python3.7/site-packages/tensorflow_core/python/framework/tensor_shape.py in assert_is_compatible_with(self, other)
1113 """
1114 if not self.is_compatible_with(other):
-> 1115 raise ValueError("Shapes %s and %s are incompatible" % (self, other))
1116
1117 def most_specific_compatible_shape(self, other):
ValueError: Shapes (128, 1) and (128,) are incompatible
This hints to me that the parameters in the underlying model should have been (128, 1)
, in the case of transform = nengo.dists.Choice([0])
, but were squeezed down to (128,)
.
from nengo-dl.
Took me a while to spot this, but transform = nengo.dists.Choice([0])
isn't actually a valid transform. It should be nengo.dists.Choice([[0]])
. If you try your code snippet in the regular Nengo simulator you'll see that you get an error there as well. It kind of works in NengoDL (other than the freeze_params thing) due to broadcasting, but that isn't intended/supported behaviour. I've submitted a fix in Nengo core to address the underlying issue (there should have been a proper validation message indicating that the Choice
dist had the wrong dimensionality), see nengo/nengo#1630.
from nengo-dl.
Shouldn't Choice([0])
be a valid transform, because we allow setting the transform as a scalar? i.e., Connection(a, b, transform=0)
is permitted, and Connection(a, b, transform=Choice([0]))
should be equivalent to that (since sampling that distribution will always return 0
).
from nengo-dl.
Related Issues (20)
- AssertionError running custom neuron with TensorFlow 2.3.0 HOT 3
- Empty probes are Python lists instead of ndarrays
- Creating a simulator while keeping pretrained weights HOT 3
- Uninformative error message when using `sim.compile` on a network with no probed outputs
- Support/examples for converting or embedding Keras RNNs HOT 1
- Support scale_firing_rates with Regular/Poisson/Stochastic spiking wrappers
- Warn if converter's scale_firing_rates would skew the nonlinearities
- Support opting in to spikes on the forward pass
- Nengo version of ModelCheckpoint callback
- Use no-input nodes by default in converter
- load_params misbehaves with scale_firing_rates for some architectures HOT 1
- Converter `synapse` not applied to `neurons`-to-`TensorNode` connections HOT 1
- Converter fails with `tf.keras.applications.EfficientNet`
- Mistake in documentation
- Trainable parameters in Nengo LIF neurons HOT 2
- Which neuromorphic hardware does NengoDL simulate ?
- sim.predict make GPU full memory HOT 7
- BatchNormalization layer produces LOW accuracy
- Importing Nengo_DL in Google Colab HOT 1
- `nengo_dl` cannot import `keras.engine` HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nengo-dl.