You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Have I written custom code: yes and it works fine for batch size 1
OS Platform and Distribution: Ubuntu 18.04
TensorFlow backend: yes
TensorFlow version: 1.13.1 (also tried on others 1.14.0)
Keras version: tried all versions from 2.2.1 to 2.3,
Python version: 3.6.8
CUDA/cuDNN version: 10.0
GPU model and memory: (tried on) titan V and GeForce 12GB
When I try to train my model with batch size greater than 1 it always gives me an error such as this one below, where he incompatible shape on the left is the product of the batch size and the shape on the right. There is a similar question #11749 but the proposed fix of using another version does not work for me. I have tried increasing the batch size to 2 with all keras versions from 2.2.1 to 2.3 and that does not solve the problem for me. Is anybody else still experiencing this issue? Could anybody help?
Could you post the output shapes of your model and the shape of the tensor containing the labels? I faced a similar issue recently.
The output shape for my model is [batch_size, seq_len, num_classes] where each row in each batch is a probability distribution over num_classes.
The shape for the labels in my dataset object was [batch_size, seq_len]. This threw an incompatible shape error. After searching for a bit, I found out that my metric fucntion (sparse_categorical_accuracy), tries to squeeze the last dimension of the labels tensor and throws an error is the last dimension is not 1.
Changing my labels tensor to the shape [batch_size, seq_len, 1] fixed the problem.
When I try to train my model with batch size greater than 1 it always gives me an error such as this one below, where he incompatible shape on the left is the product of the batch size and the shape on the right. There is a similar question #11749 but the proposed fix of using another version does not work for me. I have tried increasing the batch size to 2 with all keras versions from 2.2.1 to 2.3 and that does not solve the problem for me. Is anybody else still experiencing this issue? Could anybody help?
It works quite well as it is right now with batch size 1 but I want to increase the batch size for more stability in my training.
Thanks.
The text was updated successfully, but these errors were encountered: