Tensorflow - I don't get the right shapes - ValueError: Shapes (9, 1) and (8, 9) are incompatible

I want to train a Sequential Neural Net (NN) with Tensorflow.

bidding_nn = tf.keras.Sequential([
tf.keras.layers.Dense(units=128, activation='elu', kernel_initializer='he_uniform'),
#tf.keras.layers.Flatten(),
tf.keras.layers.Dense(units=128, activation='elu', kernel_initializer='he_uniform'),
tf.keras.layers.Dense(units=9, activation='softmax', kernel_initializer='he_uniform'),
])


and

adam = Adam(lr=0.02, decay=0.01)
loss=tf.keras.losses.CategoricalCrossentropy(),
metrics=['accuracy'])

bidding_nn.fit(train_dataset, epochs=10)


It should tell me probabilities for the 9 categories I have.

So as input for the NN, I have 8 npArrays of lengths 32 (one-hot encoded) and as output 1 npArray of lengths 9 (one-hot encoded).

(Pdb) train_dataset
<TensorSliceDataset shapes: ((8, 32), (9,)), types: (tf.float64, tf.float64)>


However, at bidding_nn.fit(train_dataset, epochs=10) I get the error message

    ValueError: Shapes (9, 1) and (8, 9) are incompatible


++++++++++++++++++++++ Answer to the problem, see https://stackoverflow.com/a/66350991/12368039

• What line of code did you run to get the ValueError you received? – Oxbowerce Feb 24 at 10:24
• when I call .fit() in here bidding_nn.fit(train_dataset, epochs=10) – Dominik Feb 24 at 10:56
• I got an answer that perfectly fit the problem here stackoverflow.com/a/66350991/12368039 – Dominik Feb 24 at 14:27
• Good to hear, please also add the exact answer that solved your problem for other users who may be getting the same error. – Oxbowerce Feb 24 at 14:33