Skip to content
This repository was archived by the owner on Jul 10, 2025. It is now read-only.

Commit 44fe506

Browse files
authored
Update doc based on comments
1 parent 01945d0 commit 44fe506

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

rfcs/20200929-keras-mixed-precision.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ print(layer2.dtype_policy.name) # mixed_float16
164164
print(layer.dtype_policy.name) # float32. A layer dtype policy never changes.
165165
```
166166

167-
The global policy is only used by Keras to determine the default layer policy, and has no other purpose. The next section describes in detail how a layer users dtype policies.
167+
The global policy is only used by Keras to determine the default layer policy, and has no other purpose. The next section describes in detail how a layer uses dtype policies.
168168

169169
To use mixed precision in a model, the global policy must be set to "mixed_float16" or "mixed_bfloat16" before the model is constructed. For many models, this is all that is required to use mixed precision.
170170

@@ -249,7 +249,7 @@ if __name__ == "__main__":
249249
app.run(main)
250250
```
251251

252-
Alternatively, the global policy can be set in `create_model`. This will work in cases where multiple models are not built in parallel using threads, and where every time a model is created, the global policy is set to an appropriate value.
252+
Alternatively, the global policy can be set in `create_model`. This is not recommended as it will cause `create_model` to modify global state, but in practice, this typically does not cause issues. If the global policy is set in `create_model`, all other functions that create models (say, a `create_resnet_model` function) should also set the global policy. This way, `create_model` and `create_resnet_model` can be called in any order without affecting the dtype of the models.
253253

254254
## Layers
255255

0 commit comments

Comments
 (0)