未验证 提交 532c3b4c 编写于 作者: Z zhangbo9674 提交者: GitHub

refine optest logic for bfloat16 (#42151)

上级 c56fffb4
...@@ -1506,6 +1506,12 @@ class OpTest(unittest.TestCase): ...@@ -1506,6 +1506,12 @@ class OpTest(unittest.TestCase):
return imperative_actual, imperative_actual_t return imperative_actual, imperative_actual_t
def convert_uint16_to_float_ifneed(self, actual_np, expect_np): def convert_uint16_to_float_ifneed(self, actual_np, expect_np):
if actual_np.dtype == np.uint16 and expect_np.dtype in [
np.float32, np.float64
]:
self.rtol = 1.e-2
else:
self.rtol = 1.e-5
if self.op_test.is_bfloat16_op(): if self.op_test.is_bfloat16_op():
if actual_np.dtype == np.uint16: if actual_np.dtype == np.uint16:
actual_np = convert_uint16_to_float(actual_np) actual_np = convert_uint16_to_float(actual_np)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册