Cannot get keras_spiking.ModelEnergy using DenseNet


I am trying to get some energy values from a DenseNet architecture and when I run the code below I get a valueError (as shown below). I tried narrowing down where the issue occurs and found that it first happens at a layers.Concatenate call in the keras implementation. Has anyone seen a similar issue to this? When I use keras’ vgg16 implementation it works, which doesn’t have a Concatenate.

from tensorflow.keras.applications import DenseNet121
import keras_spiking
import numpy as np

denseNet_model = DenseNet121(
weights=None, include_top=True, input_shape=(224, 224, 3)

energy = keras_spiking.ModelEnergy(denseNet_model, example_data=np.ones((32, 224, 224, 3)) * 3)

ValueError: could not broadcast input array from shape (32,56,56,64) into shape (32,56,56)

Hi @javierz,

The issue you are experiencing might be related to the other post you made about the Keras application models. I would recommend making an issue on the keras-spiking Github page, and posting your finding there. It’s easier for our devs to keep track of known issues that way. :slight_smile: