Skip to content

Modified compute_output_shape function to handle broadcasting behavior in layers.Rescaling #21351

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

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

Conversation

sonali-kumari1
Copy link
Contributor

  • Fixed compute_output_shape() in Rescaling to correctly handle the broadcasting and ensure consistent shapes in model.summary() and model.output_shape.
  • Improved Rescaling layer docstring with detailed description of scale and offset parameters.

Fixes #21319

@codecov-commenter
Copy link

codecov-commenter commented Jun 4, 2025

Codecov Report

Attention: Patch coverage is 73.33333% with 8 lines in your changes missing coverage. Please review.

Project coverage is 77.09%. Comparing base (de9cf25) to head (1b04bd7).
Report is 17 commits behind head on master.

Files with missing lines Patch % Lines
keras/src/layers/preprocessing/rescaling.py 73.33% 4 Missing and 4 partials ⚠️

❗ There is a different number of reports uploaded between BASE (de9cf25) and HEAD (1b04bd7). Click for more details.

HEAD has 2 uploads less than BASE
Flag BASE (de9cf25) HEAD (1b04bd7)
keras 5 4
keras-torch 1 0
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #21351      +/-   ##
==========================================
- Coverage   82.65%   77.09%   -5.56%     
==========================================
  Files         565      565              
  Lines       54823    54934     +111     
  Branches     8514     8532      +18     
==========================================
- Hits        45315    42354    -2961     
- Misses       7414    10544    +3130     
+ Partials     2094     2036      -58     
Flag Coverage Δ
keras 77.01% <73.33%> (-5.46%) ⬇️
keras-jax 63.55% <73.33%> (-0.04%) ⬇️
keras-numpy 58.68% <26.66%> (-0.07%) ⬇️
keras-openvino 33.55% <3.33%> (+0.41%) ⬆️
keras-tensorflow 63.94% <73.33%> (-0.07%) ⬇️
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.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Collaborator

@fchollet fchollet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! The change should be accompanied by a unit test.

@google-ml-butler google-ml-butler bot added kokoro:force-run ready to pull Ready to be merged into the codebase labels Jun 13, 2025
@github-project-automation github-project-automation bot moved this from Assigned Reviewer to Approved by Reviewer in PR Queue Jun 13, 2025
@fchollet
Copy link
Collaborator

Please fix the failing torch test

FAILED keras/src/layers/preprocessing/rescaling_test.py::RescalingTest::test_rescaling_broadcast_output_shape - AssertionError: False is not true : Expected output shapes (2, 2) but received torch.Size([2, 2, 2])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready to pull Ready to be merged into the codebase size:M
Projects
Status: Approved by Reviewer
Development

Successfully merging this pull request may close these issues.

Inconsistent broadcasting behaviour in layers.Rescaling
5 participants