简体   繁体   中英

Tensorflow 2 Tensors

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM