Using the Nengo DL converter with temporal models

Hi Nengo community!

I’m attempting to convert a ANN defined in Keras to an SNN using nengo_dl’s converter. Crucially, I would like Nengo to interpret the first dimension of the input (aside from the batch dimension) as timesteps. As such, I’m setting the ‘temporal_model’ parameter to ‘True’ but am running into errors trying to convert even the first layer of my network (a Conv2d layer). Here is a minimal example reproducing the error:

import keras
import nengo_dl

inp = keras.Input(shape=(100,10,1), name = 'input_layer')
conv = keras.layers.Conv2D(filters=20, kernel_size=(3,1), strides = 1, padding = 'valid', use_bias = False, activation="relu", name = 'conv_layer')(inp)
model = keras.Model(inputs=inp, outputs=conv, name = "test_model")

converter = nengo_dl.Converter(model, temporal_model=True)

The code results in the following error:

ValidationError: kernel_size: Kernel dimensions (2) does not match input dimensions (1).

I’d love some advice on how to remedy this error. The converter runs just fine with temporal_model set to False. Does anyone know if the Nengo DL converter supports Conv2d (or Conv1d) Keras layers, in particular when the convolution is over the time dimension? I wasn’t able to find any examples online. Any help would be appreciated!


Hi, and welcome to the forum!

I think that Conv2d and Conv1d layers should be supported by the converter, but my guess is that they’re not supported when the convolution is over the time dimension.