|TensorFlow 1 version||View source on GitHub|
A dtype policy for a Keras layer.
tf.keras.mixed_precision.experimental.Policy( name, loss_scale=USE_DEFAULT )
Used in the notebooks
|Used in the guide|
A dtype policy determines dtype-related aspects of a layer, such as its
computation and variable dtypes. Each layer has a policy. Policies can be
passed to the
dtype argument of layer constructors, or a global policy can
be set with
tf.keras.mixed_precision.experimental.set_policy. A layer will
default to the global policy if no policy is passed to it's constructor.
For many models, each layer's policy will have the same compute dtype and
variable dtype, which will typically be float32. In this case, we refer to the
singular dtype as the layer's dtype, which can be queried by the property
When mixed precision training is used, most layers will instead have a float16 or bfloat16 compute dtype and a float32 variable dtype, and so the layer does not have a single dtype. When the variable dtype does not match the compute dtype, variables