I am trying to download the code from the notebooks to my computer and execute them there but I have some problems, all notebooks work fine until I tried the ResNet one, I found a problem where it said something about training parameter for BatchNormalization, i fixed that one by doing
X = BatchNormalization(axis = 3)(X, training=training)
instead of
X = BatchNormalization(axis = 3)(X)
Now I found another problem in convolutional_block() that says:
Cannot convert ‘2’ to a shape.
Specifically in here:
Cell In[30], line 27
23 X3 = np.ones((1, 4, 4, 3)) * 3
25 X = np.concatenate((X1, X2, X3), axis=0).astype(np.float32)
---> 27 A = target(X, f=2, filters=[2, 4, 6], s=4, training=False, initializer=tf.keras.initializers.RandomUniform())
28 assert A.shape == (3, 1, 1, 6), "Wrong shape. Make sure you are using the stride values as expected."
29 assert np.allclose(A.numpy(), convolutional_block_output1), "Wrong values when training=False."
Cell In[29], line 27
23 ##### MAIN PATH #####
24
25 # First component of main path glorot_uniform(seed=0)
26 X = Conv2D(filters = 2, kernel_size = (1,1), strides = (4, 4), padding='valid')(X)
---> 27 X = BatchNormalization(axis = 3)(X, training=training)
28 X = Activation('relu')(X)
30 ## Second component of main path (≈3 lines)
I think it has something to do with the tensorflow version but I would like to use the last one, any ideas on what the problem is? Following the documentation (tf.keras.layers.BatchNormalization | TensorFlow v2.16.1) seems like it is ok to me.