-
Notifications
You must be signed in to change notification settings - Fork 19.6k
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 Discretization
serialization when num_bins
is used.
#20971
Conversation
Important The terms of service for this installation has not been accepted. Please ask the Organization owners to visit the Gemini Code Assist Admin Console to sign it. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #20971 +/- ##
=======================================
Coverage 82.44% 82.45%
=======================================
Files 562 562
Lines 53292 53303 +11
Branches 8255 8257 +2
=======================================
+ Hits 43936 43949 +13
+ Misses 7339 7338 -1
+ Partials 2017 2016 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
1aee0a0
to
ca2e1f1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Previously, serialization / deserialization would fail if: - the layer was saved / restored before `adapt` was called - the layer was saved / restored after `adapt` was called, but the dataset was such that the number of bins learned was fewer than `num_bins` The fix consists in adding a `from_config` to handle `bin_boundaries` separately. This is because at initial creation, `bin_boundaries` and `num_bins` cannot be both set, but when restoring the layer after `adapt`, they are both set. Tightened the error checking: - never allow `num_bins` and `bin_boundaries` to be specified at the same time, even if they match (same as `tf_keras`) - don't allow `num_bins` and `bin_boundaries` to be `None` at the same time - verify that `adapt` has been called in `call` Also removed `init_bin_boundaries` as the value was never used and its presence can be inferred.
ca2e1f1
to
1e06886
Compare
…am#20971) Previously, serialization / deserialization would fail if: - the layer was saved / restored before `adapt` was called - the layer was saved / restored after `adapt` was called, but the dataset was such that the number of bins learned was fewer than `num_bins` The fix consists in adding a `from_config` to handle `bin_boundaries` separately. This is because at initial creation, `bin_boundaries` and `num_bins` cannot be both set, but when restoring the layer after `adapt`, they are both set. Tightened the error checking: - never allow `num_bins` and `bin_boundaries` to be specified at the same time, even if they match (same as `tf_keras`) - don't allow `num_bins` and `bin_boundaries` to be `None` at the same time - verify that `adapt` has been called in `call` Also removed `init_bin_boundaries` as the value was never used and its presence can be inferred.
…am#20971) Previously, serialization / deserialization would fail if: - the layer was saved / restored before `adapt` was called - the layer was saved / restored after `adapt` was called, but the dataset was such that the number of bins learned was fewer than `num_bins` The fix consists in adding a `from_config` to handle `bin_boundaries` separately. This is because at initial creation, `bin_boundaries` and `num_bins` cannot be both set, but when restoring the layer after `adapt`, they are both set. Tightened the error checking: - never allow `num_bins` and `bin_boundaries` to be specified at the same time, even if they match (same as `tf_keras`) - don't allow `num_bins` and `bin_boundaries` to be `None` at the same time - verify that `adapt` has been called in `call` Also removed `init_bin_boundaries` as the value was never used and its presence can be inferred.
Previously, serialization / deserialization would fail if:
adapt
was calledadapt
was called, but the dataset was such that the number of bins learned was fewer thannum_bins
The fix consists in not serializing
bin_boundaries
if init was called withnum_bins
. This is consistent with howtf_keras
works.Tightened the error checking:
num_bins
andbin_boundaries
to be specified at the same time, even if they match (same astf_keras
)num_bins
andbin_boundaries
to beNone
at the same timeadapt
has been called incall
Also removed
init_bin_boundaries
as the value was never used and its presence can be inferred.