I’m trying to concatenate a tensor with shape (None, 11, 1, 1) with another tensor with shape (None,1,1,1). Reading the keras.layers.Concatenate() docs I understood that the shape should be the same except for the concatenation axis which in this case would be axis 1. However when running the following code
import keras
mainInputShape = (11,1,1)
weightInputShape = (1,1,1)
mIn = keras.layers.Input(shape=mainInputShape, name='mainInput')
wIn = keras.layers.Input(shape=weightInputShape, name='weightInput')
x = keras.layers.Concatenate(axis=0)([mIn, wIn])
I get the following error
Cell In[10], line 7
x = keras.layers.Concatenate(axis=1)([mIn, wIn])
File ~anaconda3Libsite-packageskerassrcutilstraceback_utils.py:122 in error_handler
raise e.with_traceback(filtered_tb) from None
File ~anaconda3Libsite-packageskerassrclayersmergingconcatenate.py:70 in build
del reduced_inputs_shapes[i][axis]
IndexError: list assignment index out of range
Could someone please explain what’s happening and how to fix this? I need an output tensor of shape (None, 12,1,1)?
Mitch is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.