Graph execution error VGG16

I am trying to implement a transfer learning model from a vgg16 model. Attached the code. The Image size is a 32 by 32 by 3 channels. I only try to train the two last layers of the VGG16 model. It seems to be a problem with matrix size incompatibility but I don’t see the issue with the code.

When I run the code I get the following error:

tensorflow.python.framework.errors_impl.InvalidArgumentError: Graph execution error:
Detected at node model/denseL1/MatMul defined at (most recent call last):

Code:

IMG_HEIGHT = 32

IMG_WIDTH = 32

channels = 3

aug = ImageDataGenerator(horizontal_flip=False,
vertical_flip=False,
fill_mode=“nearest”)
n_classes=43
fine_tune=2
optim_2 = Adam(lr=0.0001)

mod_vgg16 = VGG16(weights=‘imagenet’,input_shape=(IMG_HEIGHT,IMG_WIDTH,3),include_top=False)

if fine_tune > 0:
for layer in mod_vgg16.layers[:-fine_tune]:
layer.trainable = False
else:
for layer in mod_vgg16.layers:
layer.trainable = False

top_model = mod_vgg16.output
top_model = Flatten(name=“flatten”)(top_model)
top_model = Dense(1024, activation=‘relu’,name=“denseL1”)(top_model)
top_model = Dense(1024, activation=‘relu’,name=“denseL2”)(top_model)
top_model = Dropout(0.2)(top_model)
output_layer = Dense(n_classes, activation=‘softmax’,name=“denseL3”)(top_model)

model = Model(inputs=mod_vgg16.input, outputs=output_layer)

model.summary()
model.compile(
loss=‘categorical_crossentropy’,
optimizer=optim_2,
metrics=[‘accuracy’]
)

history = model.fit(aug.flow(x_train,
y_train, batch_size = 32),
validation_data = (x_test, y_test),
epochs=EPOCHS
)

Hi @eah, I have trained a VGG16 on CIFAR 10 dataset using transfer learning. Please refer to this gist for working code example and try in the similar way. Thank You.