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

Slice serialization #932

Merged
merged 2 commits into from
Sep 20, 2023
Merged

Slice serialization #932

merged 2 commits into from
Sep 20, 2023

Conversation

gleize
Copy link
Contributor

@gleize gleize commented Sep 20, 2023

Models that contain slicing cannot be serialized because of the missing handling of slices in the (de)serialize_keras_object functions.

Thus a simple functional as this one.

x = inp = Input(...)
...
x = x[:, 1:-1, 1:-1]
...
fn = Functional(inp, x)

could not be serialized.

Now it's possible with this fix.

@codecov
Copy link

codecov bot commented Sep 20, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: +3.99% 🎉

Comparison is base (c64de55) 79.73% compared to head (940163d) 83.73%.
Report is 35 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #932      +/-   ##
==========================================
+ Coverage   79.73%   83.73%   +3.99%     
==========================================
  Files         318      318              
  Lines       28627    28737     +110     
  Branches     5447     5489      +42     
==========================================
+ Hits        22827    24062    +1235     
+ Misses       4333     3159    -1174     
- Partials     1467     1516      +49     
Flag Coverage Δ
keras_core 83.63% <100.00%> (+3.96%) ⬆️
keras_core-jax 67.07% <100.00%> (?)
keras_core-numpy 60.38% <100.00%> (-0.01%) ⬇️
keras_core-tensorflow 66.87% <100.00%> (+0.05%) ⬆️
keras_core-torch 69.14% <100.00%> (-0.08%) ⬇️

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

Files Changed Coverage Δ
keras_core/ops/numpy.py 94.40% <100.00%> (-0.05%) ⬇️
keras_core/saving/serialization_lib.py 73.77% <100.00%> (+0.37%) ⬆️

... and 44 files with indirect coverage changes

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

Copy link
Contributor

@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 fix! LGTM

@fchollet fchollet merged commit 180e134 into keras-team:main Sep 20, 2023
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants