Can Not Squeeze Dim[1], Expected A Dimension Of 1, Got 499
I am trying to make an AutoEncoder and am stuck at the above error. Looking at other posts with this on Stack Exchange didn't help. Here is the error in full: InvalidArgumentErro
Solution 1:
Your issue is related to the shape of the output. sparse_categorical_crossentropy
expects integer targets (see the documentation: "When using the sparse_categorical_crossentropy loss, your targets should be integer targets.")
You are passing data which is of shape (batch_size, 1, 499)
both as the input as well as the labels:
model.fit(s_min_one, s_min_one, ...)
That's not going to work, the labels need to be of shape (batch_size, 1)
or simply (batch_size,)
.
I'm not entirely sure I understand what you are trying to accomplish, but it looks like you need to adapt the loss function accordingly.
Post a Comment for "Can Not Squeeze Dim[1], Expected A Dimension Of 1, Got 499"