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.

System Message: ERROR/3 (/usr/local/lib/python3.8/site-packages/paddle/fluid/contrib/mixed_precision/bf16/amp_utils.py:docstring of paddle.fluid.contrib.mixed_precision.bf16.amp_utils.cast_parameters_to_bf16, line 8)

Unexpected indentation.

Default is None.

System Message: WARNING/2 (/usr/local/lib/python3.8/site-packages/paddle/fluid/contrib/mixed_precision/bf16/amp_utils.py:docstring of paddle.fluid.contrib.mixed_precision.bf16.amp_utils.cast_parameters_to_bf16, line 9)

Block quote ends without a blank line; unexpected unindent.

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.