[BIG tensor] fix acc error of margin f16 #74254
Merged
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
PR Category
Operator Mechanism
PR Types
Improvements
Description
Pcard-67164
因为改动仅仅影响线性规模的参数,paddle本来 float 16运算过程也做了精度提升,只是有线性个中间结果用float16存储的,所以在保存中间结果的时候又产生了误差。
paddle中间过程拆得很碎,拆成了5个中间过程,如果仅对中间结果提升精度,改起来工作量很大。
(见Paddle/paddle/phi/kernels/gpu/margin_cross_entropy_kernel.cu:19)