Commit 126b855
Call
Within `build()`, some Keras layers where calling `super().build(input_shape)` while some were calling `self.built = True`. This would result in a different config when serializing whereby layers doing `self.built = True` would not have a `build_config`.
This change makes it consistent between all the layers as well as consistent with Keras 3.
Note that some layers need to call `Layer.build(self, input_shape)` directly to bypass some class' `build()` but still populate the information for the `build_config`.
PiperOrigin-RevId: 678454186super().build(input_shape) instead of self.built = True in all Keras layers.1 parent ed3f017 commit 126b855
File tree
3 files changed
+20
-11
lines changed- tensorflow_model_optimization/python/core
- clustering/keras
- common/keras/compression/internal
- sparsity/keras
3 files changed
+20
-11
lines changedLines changed: 5 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
669 | 669 | | |
670 | 670 | | |
671 | 671 | | |
| 672 | + | |
| 673 | + | |
672 | 674 | | |
673 | | - | |
674 | 675 | | |
675 | | - | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
676 | 679 | | |
677 | 680 | | |
678 | 681 | | |
| |||
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
404 | 404 | | |
405 | 405 | | |
406 | 406 | | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
407 | 410 | | |
408 | 411 | | |
409 | 412 | | |
| |||
445 | 448 | | |
446 | 449 | | |
447 | 450 | | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
448 | 454 | | |
449 | 455 | | |
450 | 456 | | |
| |||
Lines changed: 9 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
125 | | - | |
126 | | - | |
127 | | - | |
| 125 | + | |
128 | 126 | | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
| 127 | + | |
135 | 128 | | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
136 | 136 | | |
137 | 137 | | |
138 | 138 | | |
| |||
0 commit comments