Course 4 Wk 2 Ex 2 Unsupported operand type

x = preprocess_input(x, data_format=None) … I get the following error:
unsupported operand type(s) for /=: ‘Sequential’ and ‘Float’.
As I used x = data_augmentation in the previous line I realise that the model is sequential layers, but I cannot work out how to make that work in the preprocess_input function. Obviously I have done something incorrectly.
Help please …

It’s a little hard to come up with the mistake with just this part. Can you please tell if you are getting the error while executing the block of the function itself, or are you getting the error when using it with an input?
Also, can you please share the code of the entire function, as it would be easier to debug then. You can later delete your code

Apologies, I am running the whole cell when I get the error message. I can see that I am misusing x, but not sure how to repair.
The code up until this error is here:

base_model = tf.keras.applications.MobileNetV2(input_shape=input_shape,
base_model.trainable = False
inputs = tf.keras.Input(shape=IMG_SIZE)
x = data_augmentation
x = preprocess_input(x)
x = base_model(x, training=False)
… and on from there

inputs = tf.keras.Input(shape=IMG_SIZE)

In this line of code, the value of the ‘shape’ argument will be ‘input_shape’ I suppose, instead of ‘IMG_SIZE’. IMG_SIZE is the default value of image_shape which we are further modifying to get input_shape.

x = data_augmentation

Also, in this line, data_augmentation is a function, so you need to pass the ‘inputs’ as the argument. So, replace these 2 lines with

inputs = tf.keras.Input(shape=input_shape)
x = data_augmentation(inputs)

Thank you, that helped. Funnily enough, I thought I started with those lines, but I obviously made a mistake!

I am glad I could be of some help :grinning_face_with_smiling_eyes: