@@ -98,7 +97,7 @@ MindSpore also supports manual mixed precision. It is assumed that only one dens
...
@@ -98,7 +97,7 @@ MindSpore also supports manual mixed precision. It is assumed that only one dens
The following is the procedure for implementing manual mixed precision:
The following is the procedure for implementing manual mixed precision:
1. Define the network. This step is similar to step 2 in the automatic mixed precision. NoteThe fc3 operator in LeNet needs to be manually set to FP32.
1. Define the network. This step is similar to step 2 in the automatic mixed precision. NoteThe fc3 operator in LeNet needs to be manually set to FP32.
2. Configure the mixed precision. Use net.add_flags_recursive(fp16=True) to set all operators of the cell and its sub-cells to FP16.
2. Configure the mixed precision. Use net.to_float(mstype.float16) to set all operators of the cell and its sub-cells to FP16.
3. Use TrainOneStepWithLossScaleCell to encapsulate the network model and optimizer.
3. Use TrainOneStepWithLossScaleCell to encapsulate the network model and optimizer.