deep-learning-with-R-2nd-edition-code
deep-learning-with-R-2nd-edition-code copied to clipboard
ValueError: Exception encountered
Fitting the model: https://github.com/t-kalinowski/deep-learning-with-R-2nd-edition-code/blob/5d666f93d52446511a8a8e4eb739eba1c0ffd199/ch08.R#L295C1-L296C17
history <- model %>% fit( train_dataset, epochs = 100, validation_data = validation_dataset, callbacks = callbacks )
generates this exception:
Error in py_call_impl(callable, call_args$unnamed, call_args$named) : KeyError: 'Exception encountered when calling Functional.call().\n\n\x1b[1m13828515280\x1b[0m\n\nArguments received by Functional.call():\n • inputs=tf.Tensor(shape=(None, 180, 180, 3), dtype=float32)\n • training=True\n • mask=None'
Trying to understand the error, is sound like it is related to the breaking change in TF v2.7.0?:
The methods Model.fit(), Model.predict(), and Model.evaluate() will no longer uprank input data of shape (batch_size,) to become (batch_size, 1). This enables Model subclasses to process scalar data in their train_step()/test_step()/predict_step() methods. Note that this change may break certain subclassed models. You can revert back to the previous behavior by adding upranking yourself in the train_step()/test_step()/predict_step() methods, e.g. if x.shape.rank == 1: x = tf.expand_dims(x, axis=-1).