I think you may be using set_shape()
incorrectly. See Clarification on tf.Tensor.set_shape().
"One analogy is that tf.set_shape()
is like a run-time cast in an object-oriented language like Java. For example, if you have a pointer to an Object but know that, in fact, it is a String, you might do the cast (String) obj in order to pass obj to a method that expects a String argument. However, if you have a String s and try to cast it to a java.util.Vector, the compiler will give you an error, because these two types are unrelated."
Basically this function provides a shape definition for a tensor that has an unspecified shape (I think). It does not resize a tensor into a tensor with a different number of elements, so if you attempt to use it this way it will fail. So why doesn't it throw an error? I'm not 100% sure but I'd guess it has a similar reason to why casting an integer as a string doesn't cause an error. It is a valid operation, but may cause issues later in your code when you attempt to use the variable assuming that the shape is actually as specified during your set_shape()
call.
Consider using tf.image.resize()
instead. This function is designed to do what you are attempting to do here. It accepts a batch of images and returns a resized batch.
new_list = tf.image.resize(lista,[128,128])