cast_parameters_to_bf16¶
- paddle.fluid.contrib.mixed_precision.bf16.amp_utils. cast_parameters_to_bf16 ( place, program, scope=None, to_bf16_var_names=None ) [source]
-
Traverse all parameters in the whole model and set them to the BF16 data type. Whereas, this function will keep parameters of batchnorms in FP32. :param place: place is used to restore the BF16 weight tensors. :type place: fluid.CPUPlace|fluid.CUDAPlace :param program: The used program. :type program: Program :param scope: scope is used to get the FP32 weight tensor values.
Default is None.
- Parameters
-
to_bf16_var_names (set|list, optional) – The data types of vars in to_bf16_var_names will be set to BF16. Usually, it is the returned value of cast_model_to_bf16 API.