Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fill_constant op supports NaN and Inf #28109

Merged
merged 2 commits into from
Oct 20, 2020

Conversation

zhiqiu
Copy link
Contributor

@zhiqiu zhiqiu commented Oct 20, 2020

PR types

Bug fixes

PR changes

OPs

Describe

fill_constant op supports NaN and Inf

For example,

import paddle
import numpy as np
print(paddle.fluid.layers.fill_constant([1], 'float32', np.nan))
print(paddle.fluid.layers.fill_constant([1], 'float32', np.inf))
  • before
Tensor(shape=[1], dtype=float32, place=CPUPlace, stop_gradient=True,
       [0.])
Tensor(shape=[1], dtype=float32, place=CPUPlace, stop_gradient=True,
       [0.])
  • after
Tensor(shape=[1], dtype=float32, place=CPUPlace, stop_gradient=True,
       [nan.])
Tensor(shape=[1], dtype=float32, place=CPUPlace, stop_gradient=True,
       [inf.])

@paddle-bot-old
Copy link

Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

Copy link
Contributor

@wawltor wawltor left a comment

Choose a reason for hiding this comment

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

LGTM

@zhiqiu zhiqiu merged commit a911c19 into PaddlePaddle:develop Oct 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants