Commit cd52f64
Merge the two LossScale classes.
Before, we had the following loss scale base classes, which did the exact same thing:
* tf.keras.mixed_precision.experimental.LossScale, which only worked for the keras OptimizerV2
* An unexposed LossScale in tensorflow/python/training/experimental, which only worked for the V1 Optimizer
This change removes the Keras LossScale and merges it into the training LossScale, which now works for both Optimizers. The training LossScale is exposed as tf.train.experimental.LossScale. I moved over some functionality, comments, and style conventions from the Keras LossScale to the training LossScale.
Because the LossScale class can not rely on Keras, the Keras OptimizerV2 now calls backend.track_variable on the LossScale variables instead.
Note: I intend to cherrypick this into TF 1.14.
PiperOrigin-RevId: 2482139611 parent 9c9afc5 commit cd52f64
File tree
19 files changed
+138
-738
lines changed- tensorflow
- python
- keras/mixed_precision/experimental
- training/experimental
- tools/api/golden
- v1
- v2
19 files changed
+138
-738
lines changedLines changed: 1 addition & 26 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
99 | | - | |
| 99 | + | |
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
| |||
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | 119 | | |
145 | 120 | | |
146 | 121 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
40 | 39 | | |
41 | 40 | | |
42 | 41 | | |
| |||
45 | 44 | | |
46 | 45 | | |
47 | 46 | | |
| 47 | + | |
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| |||
0 commit comments