From b918d063275a7cbad245bfc20dc1d0cc4c723db8 Mon Sep 17 00:00:00 2001 From: zhangbo9674 <82555433+zhangbo9674@users.noreply.github.com> Date: Tue, 5 Jul 2022 10:55:03 +0800 Subject: [PATCH] refine tensor.dtype print formate for bfloat16 (#44055) * refine tensor.dtype for bloat16 * refine test * revert * refine bfloat16 print --- python/paddle/fluid/dygraph/varbase_patch_methods.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python/paddle/fluid/dygraph/varbase_patch_methods.py b/python/paddle/fluid/dygraph/varbase_patch_methods.py index 9eb044188f..48497f4b90 100644 --- a/python/paddle/fluid/dygraph/varbase_patch_methods.py +++ b/python/paddle/fluid/dygraph/varbase_patch_methods.py @@ -1039,8 +1039,11 @@ def monkey_patch_varbase(): def dtype_str(dtype): if dtype in _PADDLE_DTYPE_2_NUMPY_DTYPE: + numpy_dtype = _PADDLE_DTYPE_2_NUMPY_DTYPE[dtype] + if numpy_dtype == 'uint16': + numpy_dtype = 'bfloat16' prefix = 'paddle.' - return prefix + _PADDLE_DTYPE_2_NUMPY_DTYPE[dtype] + return prefix + numpy_dtype else: # for example, paddle.fluid.core.VarDesc.VarType.LOD_TENSOR return origin(dtype) -- GitLab