Skip to content
Advertisement

Input 0 is incompatible with layer model_2

i have a generator rev_generator that yields a tuple of two elements (numpyarray of shape (1279,300,1) , int value: 0 or 1)

then i pass it to:

JavaScript

and then a simple model

JavaScript

but when i call fit

JavaScript

it throws me an error:

JavaScript

Advertisement

Answer

If you are using the tf.data.Dataset API, you should set the batch size explicitly and not in model.fit:

JavaScript

See this:

Integer or None. Number of samples per gradient update. If unspecified, batch_size will default to 32. Do not specify the batch_size if your data is in the form of datasets, generators, or keras.utils.Sequence instances (since they generate batches).

Also note that your input shape does not match your input data. You are mixing up 1279 and 1297. Here is a working example:

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement