'tuple' object has no attribute 'compile'


—> 18 model.compile(
19 optimizer=‘adam’,
20 loss=‘sparse_categorical_crossentropy’,

AttributeError: ‘tuple’ object has no attribute ‘compile’
Why do I get this error?

This error means that your model function output is a tuple i.e. it returns a tuple, you are probably doing something like:

Model =(input, output) you need to use square brackets [… ].

1 Like