Issues with ei_saliency_and_grad_cam.ipynb

I followed all the steps in the video tutorial but the code blows up at
model = tf.keras.models.load_model(model_dir)

raise ValueError(
→ 896 f’Cannot call custom layer {} of type {type(layer)}, because ’
897 ‘the call function was not serialized to the SavedModel.’
898 ‘Please try one of the following methods to fix this issue:’

ValueError: Exception encountered when calling layer “dropout” (type Dropout).

Cannot call custom layer dropout of type <class ‘keras.saving.saved_model.load.Dropout’>, because the call function was not serialized to the SavedModel.Please try one of the following methods to fix this issue:

(1) Implement get_config and from_config in the layer/model class, and pass the object to the custom_objects argument when loading the model. For more details, see: שמור וטען מודלים של Keras  |  TensorFlow Core

(2) Ensure that the subclassed model or layer overwrites call and not __call__. The input shape and dtype will be automatically recorded when the object is called, and used when saving. To manually specify the input shape/dtype, decorate the call function with @tf.function(input_signature=...).

Call arguments received:
• unused_args=(‘tf.Tensor(shape=(None, 784), dtype=float32)’,)
• unused_kwargs={‘training’: ‘None’}

Hi @threyn3,

Which video tutorial are you referring to?


CNN Visualizations in the Week 2 Module

Hi @threyn3,

Thanks for pointing out this error. It’s a known bug with the current version and has been reported to our internal development team. If you would like to perform the visualization exercise, please remove the Dropout layers from your architecture and try again.