未验证 提交 036f81fc 编写于 作者: J JZ-LIANG 提交者: GitHub

bugfix: param init with fill constant str_value (#33381) (#33472)

上级 2b44ae5d
...@@ -152,6 +152,7 @@ class ConstantInitializer(Initializer): ...@@ -152,6 +152,7 @@ class ConstantInitializer(Initializer):
out_dtype = var.dtype out_dtype = var.dtype
out_var = var out_var = var
# fill constant should set the "str_value" to preserve precision
op = block.append_op( op = block.append_op(
type="fill_constant", type="fill_constant",
outputs={"Out": out_var}, outputs={"Out": out_var},
...@@ -159,6 +160,7 @@ class ConstantInitializer(Initializer): ...@@ -159,6 +160,7 @@ class ConstantInitializer(Initializer):
"shape": var.shape, "shape": var.shape,
"dtype": int(out_dtype), "dtype": int(out_dtype),
"value": float(self._value), "value": float(self._value),
'str_value': str(float(self._value)),
'force_cpu': self._force_cpu 'force_cpu': self._force_cpu
}, },
stop_gradient=True) stop_gradient=True)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册