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

Fix issue with nested model output as input #20678

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Surya2k1
Copy link
Contributor

Currently with nested model output as input to functional model fails as tensor_dict not updated. The below code fails.

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)))

Done the changes to make it work not seems elegant though. But for this case it works and no functional model tests are failing with this change.

Context from #20473

@codecov-commenter
Copy link

codecov-commenter commented Dec 23, 2024

Codecov Report

Attention: Patch coverage is 42.85714% with 4 lines in your changes missing coverage. Please review.

Project coverage is 72.12%. Comparing base (3dd958b) to head (55e741e).

Files with missing lines Patch % Lines
keras/src/ops/function.py 42.85% 2 Missing and 2 partials ⚠️

❗ There is a different number of reports uploaded between BASE (3dd958b) and HEAD (55e741e). Click for more details.

HEAD has 4 uploads less than BASE
Flag BASE (3dd958b) HEAD (55e741e)
keras 5 3
keras-numpy 1 0
keras-torch 1 0
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #20678      +/-   ##
==========================================
- Coverage   81.97%   72.12%   -9.86%     
==========================================
  Files         544      544              
  Lines       50751    50756       +5     
  Branches     7851     7854       +3     
==========================================
- Hits        41604    36607    -4997     
- Misses       7252    12364    +5112     
+ Partials     1895     1785     -110     
Flag Coverage Δ
keras 72.05% <42.85%> (-9.77%) ⬇️
keras-jax 63.95% <42.85%> (+<0.01%) ⬆️
keras-numpy ?
keras-openvino 29.93% <14.28%> (-0.01%) ⬇️
keras-tensorflow 64.70% <42.85%> (+<0.01%) ⬆️
keras-torch ?

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants