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
Others
PR changes
Others
Description
为XPU下面的bfloat16单测做准备:
mean
算子的注册类型,因为:paddle/phi/kernels/reduce_mean_kernel.cc
里面已经有了bfloat16的注册;op_test_xpu.py
里面有调用mean_grad_op_types = get_xpu_op_support_types('mean')
,根据不同结果,会走不同的计算逻辑。在单测中,float16和bfloat16没啥本质区别,都属于“非float32”的浮点型。op_test_xpu.py
里面有个针对float16的特殊处理,本PR增加了对bfloat16的特殊处理,并大幅缩小这个检查阈值(不知道前一个版本中为什么放1.0这么大的数)。先拍一个0.1放在这里,后续如有需求再调整。test_adamw_op_xpu.py
里面有个地方用了self.in_type_str
,在bfloat16的时候会报错,因此改成了self.in_type
。其它:
paddle/phi/kernels/funcs/tensor_formatter.cc
,增加对float16和bfloat16的支持。要不然用它来调试的时候,会提示“unprintable type”。为了能过覆盖率检查,修改了PrintOp
的GPU单测。