Conv2D with 'same' padding with Nengo Loihi

Hi,

I currently work on building ResNet for Loihi by using NengoDL converter and NengoLoihi with reference to the tutorial of “Converting a Keras model to an SNN on Loihi (https://www.nengo.ai/nengo-loihi/examples/keras-to-loihi.html).”

The ResNet has the Conv2D with ‘same’ padding, but it seems the Conv2D with ‘same’ padding is not supported by NengoLoihi. When I attempted to run a part of ResNet, I got the following message:
“NotImplementedError: nengo-loihi only supports convolution with ‘valid’ padding.”

Has anyone implemented the ResNet on Loihi by using NengoDL converter and NengoLoihi? And, if the Conv2D with ‘same’ padding cannot be used, the outputs of the the Conv2D are shrunk. Are there solutions to avoid it?

Thank you.
Kamei

Hi Kamei,

No one has ever implemented ResNet on Loihi that I know of, either with the converter or otherwise. As you said, if you use “valid” padding your output will shrink after each layer, and ResNet has so many layers that by the end, the shrinkage will be too much. I’ve implemented “same” padding for nengo.Convolution in NengoLoihi in the same-padding branch.

Hi,

Thank you so much for your prompt reply and patch of ‘same’ padding!

To check execution in my environment, I applied the patch and executed the tutorial with ‘same’ padding instead of ‘valid’ padding.
I could execute the tutorial in my environment, but I found the small bug at the nengo_loihi/builder/connection.py:760-763.
There are assertion code at that lines, so I commented out the lines.

I was able to execute the tutorial with ‘same’ padding, so, next, I try to build ResNet by using Conv2D with ‘same’ padding.

And, thank you for the information about ResNet on Loihi.

Thank you.
Kamei