Error in model save , homework week3 C4W3

hello i get the following error when i run my model save

AttributeError Traceback (most recent call last)
1 # Save your model in the SavedModel format
----> 2‘saved_model/my_model’)
4 # Compress the directory using tar
5 get_ipython().system(’ tar -czvf saved_model.tar.gz saved_model/')

/opt/conda/lib/python3.8/site-packages/keras/utils/ in error_handler(*args, **kwargs)
65 except Exception as e: # pylint: disable=broad-except
66 filtered_tb = _process_traceback_frames(e.traceback)
—> 67 raise e.with_traceback(filtered_tb) from None
68 finally:
69 del filtered_tb

/opt/conda/lib/python3.8/site-packages/keras/layers/core/ in _serialize_function_to_config(self, inputs, allow_raw)
279 module = inputs.module
280 elif callable(inputs):
→ 281 output =
282 output_type = ‘function’
283 module = inputs.module

AttributeError: ‘Lambda’ object has no attribute ‘name


Please click my name and message your notebook as an attachment.

The error you are observing is due to the last layer in your model. There’s no need to use a lambda layer inside another lambda layer like tf.keras.layers.Lambda(tf.keras.layers.Lambda(...)). It’s sufficient to have a single lambda layer to perform the computation.