ageron / ageron/handson-ml2

Chapter 11 : Reusing a Keras model

Open
#143 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Jupyter Notebook
Stars
30k
Forks
13.1k
PR merge metrics
No merged PRs in 30d

Description

Hi @ageron

I am getting an error " ValueError: The name "dense" is used 2 times in the model. All layer names should be unique." with the last line in Cell 60.

>
> **Cell 60:
> .....
> model_B_on_A.add(keras.layers.Dense(1, activation="sigmoid"))**
>

Just to rule out any errors from my side, I copied the code from the Note book from github, still receiving the same error. I even tried restarting the kernal as well as issuing a keras.backend.clear_session(). But no success.

So, I added a customized name for the time being to move forward as below:
model_B_on_A.add(keras.layers.Dense(1, name = "dense_final", activation="sigmoid"))

My environment:
tensorflow 2.0.0,
keras 2.2.4-tf
Python 3.7.6

Not sure whether I did some thing wrong to get the above error or does it need the 'name' parameter for the last layer to remove ambiguity.

Thanks
Satya

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.