You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The scenario is that I want to convert a Keras network to a subnetwork in a larger Nengo network. Currently this doesn't work because I can't pass input into the converted network. I can hack this in by changing
@Converter.register(tf.keras.layers.InputLayer)
class ConvertInput(LayerConverter):
"""Convert ``tf.keras.layers.InputLayer`` to Nengo objects."""
def convert(self, node_id):
try:
# if this input layer has an input obj, that means it is a passthrough
# (so we just return the input)
output = self.get_input_obj(node_id)
except KeyError:
# not a passthrough input, so create input node
shape = self.output_shape(node_id)
if any(x is None for x in shape):
raise ValueError(
"Input shapes must be fully specified; got %s" % (shape,)
)
# output = nengo.Node(np.zeros(np.prod(shape)), label=self.layer.name)
output = nengo.Node(size_in=np.prod(shape), label=self.layer.name)
...
and then i can
with nengo.Network() as net:
converter = nengo_dl.Convert(model)
vision = converter.net
ens = nengo.Ensemble(...)
nengo.Connection(ens, converter.inputs[model.input])
nengo.Connection(converter.layers[model.output_layer], ens)
which isn't great but works. But now it no longer works when just running it in with the nengo dl sim.predict. Since i'm unfamiliar with the code i'm not sure what setting it to handle both cases would look like, but ideally there would be another function to export to a subnetwork. So i could
with nengo.Network() as net:
converter = nengo_dl.Convert(model, make_subnet=True)
visionnet = converter.ExportSubNet()
ens = nengo.Ensemble(...)
nengo.Connection(ens, visionnet.input)
nengo.Connection(visionnet.outpt, ens)
or somesuch!
The text was updated successfully, but these errors were encountered:
The scenario is that I want to convert a Keras network to a subnetwork in a larger Nengo network. Currently this doesn't work because I can't pass input into the converted network. I can hack this in by changing
and then i can
which isn't great but works. But now it no longer works when just running it in with the nengo dl
sim.predict
. Since i'm unfamiliar with the code i'm not sure what setting it to handle both cases would look like, but ideally there would be another function to export to a subnetwork. So i couldor somesuch!
The text was updated successfully, but these errors were encountered: