Thank you for your prompt response, apologies for my own delay.
I can imagine that the upsampling operation is more easily done off the Loihi chip, do you think that is the layer that is causing the converter to use passthrough nodes?
Here is a few snippets of the code I’ve been running:
#these arrays hold 16 bit integer audio data with
# 8 channels for input data and 1 channel in the output
mixes = np.array(mixes).reshape((-1,256,8))
targets = np.array(targets).reshape((-1,256,1))
#keras model
dummyModel = tf.keras.Sequential()
activation = tf.keras.activations.relu
#model layers
dummyModel.add(tf.keras.layers.Conv1D(8,4, input_shape=(256,8), padding="same",
activation=activation))
dummyModel.add(tf.keras.layers.AveragePooling1D(4, padding="valid"))
dummyModel.add(tf.keras.layers.Conv1D(8,4, padding="same", activation=activation))
dummyModel.add(tf.keras.layers.AveragePooling1D(4, padding="valid"))
dummyModel.add(tf.keras.layers.UpSampling1D(size=4))
dummyModel.add(tf.keras.layers.Conv1D(8,4, padding="same", activation=activation))
dummyModel.add(tf.keras.layers.UpSampling1D(size=4))
dummyModel.add(tf.keras.layers.Conv1D(1,8, padding="same", activation=activation))
dummyModel.compile("adam", "mse")
# the model was trained for 20 epochs just so that a comparison can be
# made with a model that is slightly better than random
# these imports were taken from a code example I found in the nengo forum
# which showed how to use Loihi energy probes
from nxsdk.graph.monitor.probes import PerformanceProbeCondition
from nxsdk.api.n2a import ProbeParameter
nengo_loihi.set_defaults()
# Convert to spiking network
nengo_converter = nengo_dl.Converter(simpleModel,
swap_activations={tf.keras.activations.relu: nengo.SpikingRectifiedLinear()})
snnNet = nengo_converter.net
run_time = 30
dt = 0.001
sim = nengo_loihi.Simulator(snnNet, dt=dt)
# Set up energy probe
board = sim.sims["loihi"].nxsdk_board
probe_cond = PerformanceProbeCondition(
tStart=1, tEnd=int(run_time / dt) * 10, bufferSize=1024 * 5, binSize=4)
e_probe = board.probe(ProbeParameter.ENERGY, probe_cond)
with sim:
sim.run(run_time)
# BuildError: nengo-loihi does not yet support 'Sparse' transforms on host to chip connections
When I switch out ```sim`` for nengo’s default simulator (omitting the energy probe setup of course) the example runs just fine which I suspected is because Loihi doesn’t support one of the layer types I am using. I simplified the network to include only convolution layers and use a functional model rather than the sequential keras model, but I still encountered the exact same error. This is the other model I tried:
#Functional model (as opposed to sequential)
inp = tf.keras.Input(shape=(256, 8, 1))
conv1 = tf.keras.layers.Conv2D(
filters=16,
kernel_size=(16,2),
activation=tf.nn.relu,
)(inp)
conv2 = tf.keras.layers.Conv2D(
filters=16,
kernel_size=(8,4),
activation=tf.nn.relu,
)(conv1)
# It doesn't matter that the output dimensions are different
# because I didn't attempt to train this model
simpleModel = tf.keras.Model(inputs=inp, outputs=conv2)
simpleModel.compile("adam", "mse")
Any insights as to what I’m missing would be appreciated, thank you.