Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raise error if inputs are not connected with output in functional model #20705

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Surya2k1
Copy link
Contributor

Raise error if inputs are not connected with output in functional model.

The below code fails with tensor_dict related error which is not useful to users.

model_1 = Sequential([
    Input(shape=(6,)),
    layers.Dense(3, activation="sigmoid"),
])

model_2 = Sequential([
    Input(shape=(3,)),
    layers.Dense(1, activation="sigmoid"),
], )

combined = Model(Input(shape=(6,)), model_2(model_1(Input(shape=(6,)))), name='nested_model')
combined.compile(loss='binary_crossentropy', optimizer='adam')
output = combined.train_on_batch(np.random.normal(0, 1, (8, 6)), np.random.normal(0, 1, (8, 1)))

@codecov-commenter
Copy link

codecov-commenter commented Dec 31, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.02%. Comparing base (c8c2c6f) to head (3ebb7b0).
Report is 43 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #20705      +/-   ##
==========================================
+ Coverage   81.94%   82.02%   +0.07%     
==========================================
  Files         548      557       +9     
  Lines       51128    52017     +889     
  Branches     7906     8039     +133     
==========================================
+ Hits        41897    42667     +770     
- Misses       7296     7398     +102     
- Partials     1935     1952      +17     
Flag Coverage Δ
keras 81.84% <100.00%> (+0.07%) ⬆️
keras-jax 64.23% <100.00%> (+0.24%) ⬆️
keras-numpy 58.97% <100.00%> (+0.04%) ⬆️
keras-openvino 30.09% <100.00%> (+0.20%) ⬆️
keras-tensorflow 64.80% <100.00%> (+0.12%) ⬆️
keras-torch 64.19% <100.00%> (+0.13%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@fchollet
Copy link
Collaborator

Thanks for the PR! This seems to be triggering a test failure for the TF backend, can you take a look?

@Surya2k1
Copy link
Contributor Author

The test is failing as the inputs and outputs not connected. Hence re-writing the testcase.

@Surya2k1
Copy link
Contributor Author

Ping: @fchollet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Assigned Reviewer
Development

Successfully merging this pull request may close these issues.

4 participants