votes up 5

Shapes %s and %s are incompatible

Exception Class:

Raise code

      other: Another TensorShape.

      ValueError: If `self` and `other` do not represent the same shape.
    if not self.is_compatible_with(other):
      raise ValueError("Shapes %s and %s are incompatible" % (self, other))

  def most_specific_compatible_shape(self, other):
    """Returns the most specific TensorShape compatible with `self` and `other`.

    * TensorShape([None, 1]) is the most specific TensorShape compatible with
      both TensorShape([2, 1]) and TensorShape([5, 1]). Note that
      TensorShape(None) is also compatible with above mentioned TensorShapes. """
😲 Agile task management is now easier than calling a taxi. #Tracklify
🙏 Scream for help to Ukraine
Today, 25th May 2022, Russia continues bombing and firing Ukraine. Don't trust Russia, they are bombing us and brazenly lying in same time they are not doing this 😠, civilians and children are dying too! We are screaming and asking exactly you to help us, we want to survive, our families, children, older ones.
Please spread the information, and ask your governemnt to stop Russia by any means. We promise to work extrahard after survival to make the world safer place for all.

Ways to fix

votes up 1 votes down

Tensorflow Dimension represents the value of one dimension in a TensorShape.

merge_with allows us to merge 2 the same dimension tensor compat each other.

Error code:

import tensorflow as tf 

compat_1 = tf.compat.v1.Dimension(3)
compat_2 = tf.compat.v1.Dimension(4)
merge_one =compat_1.merge_with(compat_2)

As you can see here, we have 2 different dimensions compat. That's why the error occurs.

Fix code:

import tensorflow as tf 

compat_1 = tf.compat.v1.Dimension(3)  
compat_2 = tf.compat.v1.Dimension(3) 
merge_one =compat_1.merge_with(compat_2)
Jul 04, 2021 anonim answer
anonim 13.0k

Add a possible fix

Please authorize to post fix