DLS 4 week 3 assignment 2

Hello . I have passed all the tests but when submit my work get 0% with error :
Cell #8. Can’t compile the student’s code. Error: ValueError(‘The kernel_size argument must be a tuple of 2 integers. Received: None’) please any one can help!

Hi @Zien_Mahrouseh ,

Put a print statement in the code where kernel_size is obtained to find out what values it contains. If it is not a tuple of 2 integers, then find out why.

Print statement is a simple and effective way to debug.

Thanks for your replay but i don’t passing variable to this argument i set it by my hand for ex:
Conv2D(n_filters, # Number of filters
(3,3), # Kernel size
activation=‘relu’,
padding=‘same’,
kernel_initializer=‘he_normal’) so i can’t print any thing

Hi @Zien_Mahrouseh ,

According to Keras reference menu on Conv2D, kernel size is either an integer or a tuple of integers. However from the implementation instruction, kernel_size is set to 3, a single integer:

Exercise 1 - conv_block

Implement conv_block(...). Here are the instructions for each step in the conv_block, or contracting block:

  • Add 2 Conv2D layers with n_filters filters with kernel_size set to 3, kernel_initializer set to ‘he_normal’, padding set to ‘same’ and ‘relu’ activation.
  • if dropout_prob > 0, then add a Dropout layer with parameter dropout_prob
  • If max_pooling is set to True, then add a MaxPooling2D layer with 2x2 pool size

I suggest, you set the kernel_size to 3 and refresh the Python kernel clearing all output and rerun the code from start, checking all the output matching the expected output before submitting to the grader.