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

Tweaks for serialization of DTypePolicy in ops/layers. #19728

Merged
merged 1 commit into from
May 17, 2024

Conversation

hertschuh
Copy link
Contributor

  • Subclasses of Operation / Layer which override __init__ and use the dtype parameter don't expect a dict. We deserialize the DTypePolicy in from_config.
  • The auto get_config feature would break when a DTypePolicy was passed to the constructor of any Operation or Layer subclass not implementing get_config.

- Subclasses of `Operation` / `Layer` which override `__init__` and use the `dtype` parameter don't expect a `dict`. We deserialize the `DTypePolicy` in `from_config`.
- The auto `get_config` feature would break when a `DTypePolicy` was passed to the constructor of any `Operation` or `Layer` subclass not implementing `get_config`.
@codecov-commenter
Copy link

codecov-commenter commented May 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 78.52%. Comparing base (097673f) to head (ef04311).

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #19728   +/-   ##
=======================================
  Coverage   78.52%   78.52%           
=======================================
  Files         498      498           
  Lines       45757    45761    +4     
  Branches     8454     8456    +2     
=======================================
+ Hits        35931    35935    +4     
  Misses       8091     8091           
  Partials     1735     1735           
Flag Coverage Δ
keras 78.37% <100.00%> (+<0.01%) ⬆️
keras-jax 61.94% <100.00%> (+<0.01%) ⬆️
keras-numpy 56.29% <100.00%> (-0.01%) ⬇️
keras-tensorflow 63.41% <100.00%> (+<0.01%) ⬆️
keras-torch 62.00% <100.00%> (+<0.01%) ⬆️

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.

Copy link
Member

@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.

LGTM, thanks for the PR!

@google-ml-butler google-ml-butler bot added kokoro:force-run ready to pull Ready to be merged into the codebase labels May 17, 2024
@fchollet fchollet merged commit 6e40533 into keras-team:master May 17, 2024
7 checks passed
@google-ml-butler google-ml-butler bot removed awaiting review ready to pull Ready to be merged into the codebase kokoro:force-run labels May 17, 2024
@hertschuh hertschuh deleted the dtype_serialization branch May 17, 2024 17:50
@gbaned gbaned added this to Assigned Reviewer in PR Queue via automation May 18, 2024
mloc added a commit to mloc/keras that referenced this pull request May 22, 2024
As of keras-team#19728, Operation.from_config() has been overriding the dtype
field in the passed config dict.
There doesn't seem to be an explicit contract that from_config doesn't
modify the config argument, but this seems to be the case in practice,
and this behaviour has broken some code on an internal repo.
fchollet pushed a commit that referenced this pull request May 22, 2024
As of #19728, Operation.from_config() has been overriding the dtype
field in the passed config dict.
There doesn't seem to be an explicit contract that from_config doesn't
modify the config argument, but this seems to be the case in practice,
and this behaviour has broken some code on an internal repo.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
PR Queue
Assigned Reviewer
Development

Successfully merging this pull request may close these issues.

None yet

4 participants