Tensorflow 2.0 [condition X == Y Did Not Hold Element-wise:]
I am training a chess program using TensorFlow 2 and Keras. Previously, I had this working if I loaded the data in the same script as the training of the model, but as the dataset
Solution 1:
The Dense layer expects the flattened data.
Try:
tf.keras.layers.Flatten()
before calling the dense layer.
Solution 2:
The problem is that your loss functions receives 2 tensors with different shapes
[Condition x == y did not hold element-wise:] [x (loss/output_1_loss/SparseSoftmaxCrossEntropyWithLogits/Shape_1:0) = ] [32 1] [y (loss/output_1_loss/SparseSoftmaxCrossEntropyWithLogits/strided_slice:0) = ] [32 8]
So one of inputs has shape [32, 1] and other is [32, 8], but loss function requires input shape to be equal. As I understood, you have 8 classes, so you need your model output to be [32, 8]. Replace units=600
by units=8
in
tf.keras.layers.Dense(activation='relu', units=600)
or add other layers to have the output shape (batch_size, 8)
Solution 3:
I had this error message also when x-values were out of the range (0,1)
Post a Comment for "Tensorflow 2.0 [condition X == Y Did Not Hold Element-wise:]"