0

Hello I am trying to use the last example from keras Conv2D

# With extended batch shape [4, 7]:  
import tensorflow as tf
input_shape = (4, 7, 127, 127, 3)
x = tf.random.normal(input_shape)
y = tf.keras.layers.Conv2D(2, 3, activation='relu', input_shape=input_shape[2:])(x)
print(y.shape)

However I am getting a shape error:

ValueError: Input 0 of layer conv2d_11 is incompatible with the layer: expected ndim=4, found ndim=5. Full shape received: [4, 7, 127, 127, 3]
aiguy990
  • 1
  • 1
  • What do you mean by extended batch shape? are you feeding in a batch of videos? – Richard X Jul 02 '20 at 00:32
  • My batches are sequences of images captured from different views. you can consider them as videos. my intended shape in the model summary would be `(BS, SEQ, IMG_W ,IMG_H, CH)` – aiguy990 Jul 02 '20 at 07:23
  • The example you are referring to uses tensorflow version 2.3.0, so you probably need to update tensorflow. – GentlemanJenkins Jul 29 '20 at 18:15
  • @aiguy990 - Yes, I agree with GentlemanJenkins and I just verified that it runs fine in 2.3.0 – Anton Codes Nov 24 '20 at 04:50

0 Answers0