Week 2 Assignment 1 BatchNormalization

I am getting this error :

(‘Input has undefined rank:’, TensorShape(None))

When I run this line —

X = BatchNormalization(axis = 3)(X, training=training)

Can some please help me with this error?

Thank you.

Are you sure you mentioned the correct assignment?
Nowhere in this exercise do you need to use axis= or training=.
Which function are you working on?

It was assignment 1, week-2, my fault.

This piece of code belong to - identity_block function.


There is nothing wrong with that line of code.

Then what should I do with the error?

Why do you think that line of code is causing an error?

Please post more information - a screen capture image showing the error, for example.

The problem is that you have not provided an input tensor to the Conv2D layer in the Third Component of the Main Path. As a result X (the LHS of that assignment statement) becomes a function, not a tensor. That is why the following BatchNorm is throwing that error.

Once you get it to work, please edit your post to remove the source code.

Thank you, found my mistake.

1 Like

Great! Thanks for removing the source code.

1 Like