C4 W2 A1: Convolutional_block


GRADED FUNCTION: convolutional_block

def convolutional_block(X, f, filters, s = 2, training=True, initializer=glorot_uniform):

mentor edit: code removed

error →
NameError Traceback (most recent call last)
8 X = np.concatenate((X1, X2, X3), axis = 0).astype(np.float32)
—> 10 A = convolutional_block(X, f = 2, filters = [2, 4, 6], training=False)
12 assert type(A) == EagerTensor, “Use only tensorflow and keras functions”

in convolutional_block(X, f, filters, s, training, initializer)
22 # Define the input as a tensor with shape input_shape
—> 23 X_input = Input(input_shape)

NameError: name ‘input_shape’ is not defined

Input_shape is not a parameter in the function!

Hi @Sanchay12,

I have moved this post to the DLS Course 4 category as other learners taking the same course might benefit from this.

Kindly make sure if you have any course-specific queries, explore the specialization category and post in the relevant course subcategory as course-specific mentors are actively answering the queries there. The General Discussions category is not monitored by our mentors.

Thank you

I’m not quite sure what you’re doing with the convolutional_block() function, but it appears that you’re ignored the provided code for “MAIN PATH”, not used the “filters” argument correctly, not used a shortcut path, and included your own Model statement which doesn’t belong there.

I’m going to delete the code from your post, so it doesn’t confuse future students (and it also breaks the course Honor Code).

If you’re still having problems with this function, please post back some questions and avoid including your code.