Week2 Assignment2 Exercise2

apply data augmentation to the inputs

x = data_augmenter()

# data preprocessing using the same weights the model was trained on
x = preprocess_input()

I am using this for alpaca_model(), it asks x as a positional argument, but when I add x as the positional argument, it shows an error: unsupported operand type(s) for /=: ‘Sequential’ and ‘float’

What is the input to the “preprocess_input” function? Note that you are using the Keras “Functional API” here: you have to say what the input is. It’s not implicitly the output of the previous layer as in the “Sequential API”.

The same question applies to the previous call to data_augmenter().

Yes, adding the inputs helped,
Thanks a lot

@paulinpaloalto I’m still facing this same exact issue, when you say we need to say what the input is. You mean what object type?

ie: something like


Apologies If I am misunderstanding.

You shouldn’t need to say anything about the type, but the function takes one or more inputs, right? What is the definition of the function? The point in the “Functional API” here is that everything is explicit: if the function takes an input, then you have to supply an input. What tensor is it that you want to feed to the function? If it produces an output (or outputs, see the function definition), then you need to assign those to variables. As in:

outputTensor = myFunction(inputTensor)

So take a look at the instructions and everything they tell you in the comments and the template code and (with the above in mind) it should be more clear.

1 Like