[AMP] refine AMP and the corresponding tests for bfloat16 #12787
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.
This PR fixes issue #12763, where some OP are marked to keep the original dtype but some of its input is
bfloat16while aCastis missing.The AMP tests have also been refined to cover
bfloat16without accuracy checking.Update:
The accuracy checking in
test_dnnl.pyof bf16 vs fp32 is unstable and error-prone. Thus the accuracy checking is ignored if only one bf16 result present, i.e. only compare bf16 vs bf16 and fp32 vs fp32.