Week2 : Transfer Learning alpaca model

I am kinda stuck here. Also , x = base_model(image_batch, training=False) correct ?prediction_layer = tfl.Dense(1, activation=‘linear’)(x) are these correct parameters? Thanks in advance.

Hi Suhas,

Your definition of prediction_layer consists of an application of a Dense layer to a tensor. In result, prediction_layer becomes a tensor object rather than a layer. This is why you get the error ‘…Tensor’ object is not callable when trying to use prediction_layer as a layer.

So you have to redefine prediction_layer in such a way that the Dense layer is not yet applied to a tensor.

Same error message. is there any hint?

Hi reeshi80,

If you get the same error message the hint is

i get this error now
“Tensor.op is meaningless when eager execution is enabled.”

def alpaca_model(image_shape=IMG_SIZE, data_augmentation=data_augmenter()):
‘’’ Define a tf.keras model for binary classification out of the MobileNetV2 model
image_shape – Image width and height
data_augmentation – data augmentation function

Hi reeshi,

data augmentation should be applied to all the inputs. And the base_model should be applied to the entire augmented dataset.

Thank you. it worked.


Could you please remove your code? Many thanks and good luck with the rest of the course!

I have the exact same problem, would you elaborate on how you solved it?