Skip to content

Commit

Permalink
bugfix: param init with fill constant str_value
Browse files Browse the repository at this point in the history
  • Loading branch information
JZ-LIANG committed Jun 7, 2021
1 parent 7101af3 commit 8f54ac8
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions python/paddle/fluid/initializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,13 +152,15 @@ def __call__(self, var, block=None):
out_dtype = var.dtype
out_var = var

# fill constant should set the "str_value" to preserve precision
op = block.append_op(
type="fill_constant",
outputs={"Out": out_var},
attrs={
"shape": var.shape,
"dtype": int(out_dtype),
"value": float(self._value),
'str_value': str(float(self._value)),
'force_cpu': self._force_cpu
},
stop_gradient=True)
Expand Down

1 comment on commit 8f54ac8

@paddle-bot-old
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Congratulation! Your pull request passed all required CI. You could ask reviewer(s) to approve and merge. 🎉

Please sign in to comment.