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

randn API: remove out, device, stop_gradient; add name #25409

Merged
merged 6 commits into from
Jul 14, 2020

Conversation

zhupengyang
Copy link
Contributor

@zhupengyang zhupengyang commented Jul 7, 2020

PR types

Others

PR changes

APIs

Describe

  • randn API
    • remove out, devive, stop_gradient
    • add name
    • update doc&examples to 2.0
  • gaussian_random API
    • add name

image

@paddle-bot-old
Copy link

paddle-bot-old bot commented Jul 7, 2020

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

wangchaochaohu
wangchaochaohu previously approved these changes Jul 7, 2020
swtkiwi
swtkiwi previously approved these changes Jul 8, 2020
Copy link
Contributor

@swtkiwi swtkiwi left a comment

Choose a reason for hiding this comment

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

LGTM

@zhupengyang zhupengyang requested a review from gfwm2013 July 8, 2020 03:07
gfwm2013
gfwm2013 previously approved these changes Jul 8, 2020
Copy link
Contributor

@gfwm2013 gfwm2013 left a comment

Choose a reason for hiding this comment

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

LGTM

python/paddle/tensor/random.py Show resolved Hide resolved

"""
if dtype is None:
dtype = 'float32'
Copy link
Contributor

Choose a reason for hiding this comment

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

类型检查为什么去掉了?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

调用的gaussian_random,会在gaussian_random里面进行check,这里重复check的话效率比较低

Copy link
Contributor

Choose a reason for hiding this comment

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

两个OP名字不一样,这样报错的时候会报gaussian_random出错,而用户会觉得自己没有调用这个op,引起困惑。
效率的问题,静态图是在编译期,所以没有影响,动态图不进行类型检查,也不会有影响。

Copy link
Contributor Author

Choose a reason for hiding this comment

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

check_type(shape, 'shape', (list, tuple, Variable), 'gaussian_random/randn')
check_dtype(dtype, 'dtype', ['float32', 'float64'], 'gaussian_random/randn')

gaussian_random里面的check信息暂时这样写?如果是randn的报错应该也能理解。

Copy link
Contributor

@swtkiwi swtkiwi left a comment

Choose a reason for hiding this comment

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

LGTM

@zhupengyang zhupengyang merged commit 2502925 into PaddlePaddle:develop Jul 14, 2020
@zhupengyang zhupengyang deleted the randn-0707 branch July 14, 2020 08:13
@zhupengyang zhupengyang changed the title randn API: remove out, devive, stop_gradient; add name randn API: remove out, device, stop_gradient; add name Jul 21, 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.

None yet

5 participants