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 types
Bug fixesPR changes
OthersDescription
Pcard-70458
fix dtype mismatch error for static graph
一些模型中会调用cast api将tensor手动转换为fp16/fp32类型,在之前的升级中cast op被跳过未做处理,所以在amp改写program的过程中,cast op的输入来自于前面的OP,其类型可能已经被修改,从而和in_dtype的属性不一致,另外输出tensor需要根据out_dtype属性去设置。
如果类型不一致,会导致反向cast_grad的输出类型不符合预期,引起后续算子报错