ValueError Course 2 week 3 assignment

I keep getting the following error when trying to run the model. Why is that and How can I fix this?
ValueError: logits and labels must have the same shape ((32, 6, 1) vs (32, 4, 1))

Hi @ahsan,

It seems like you may have the wrong shape for labels. It appears that it is (4, 1) while it should be (6, 1).
What is your output for cell 20?
==> print(next(iter(new_y_test)))

Could it have been an issue with the one_hot encoding?

i got same error

my cell20 output is:

[0.]], shape=(4, 1), dtype=float32)

is this wrong??

I have got the same error and my size is 4,1 this is what is present in the expected output cell

So, just to be clear. The one_hot_matrix_test is indeed a (4, 1) tensor, but that is because the test is calling your one_hot function with a depth of 4.

Now, in the one_hot_matrix, you need two operations. First calling tf.one_hot, then tf.reshape.

To test the right shape for the exercise, you can just print the shape of one sample after the following code:

new_y_test =
new_y_train =

That should output a (6, 1) tensor (because there are 6 classes).

I suggest that if you are having trouble with the shapes, that you take a look a the one_hot_matrix code since it is a bit tricky to get right.