Reputation: 69
Currently getting the below error with my tensor when utilising Tensorflow 2:
tensorflow:Model was constructed with shape (None, 8) for input KerasTensor(type_spec=TensorSpec(shape=(None, 8), dtype=tf.float32, name='dense_input'), name='dense_input', description="created by layer 'dense_input'"), but it was called on an input with incompatible shape (None, 1, 8).
Just wondering on how I'd reshape it to get a shape of None,8 instead of None, 1, 8. I've used tf.reshape before but I'm unsure how to use it in this circumstance.
Upvotes: 0
Views: 813
Reputation: 1541
https://www.tensorflow.org/api_docs/python/tf/squeeze
tf.squeeze(input)
will remove all axes of size 1
or
tf.squeeze(input, 1)
will remove only the 1st axis from input
Upvotes: 1