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

Refine paddle.manual_seed #26496

Merged
merged 28 commits into from
Aug 28, 2020
Merged

Conversation

zhiqiu
Copy link
Contributor

@zhiqiu zhiqiu commented Aug 20, 2020

PR types

Function optimization

PR changes

APIs

Describe

Refine paddle.manual_seed()

  • use default generator to control random number generation
  • return default generator
  • update doc
  • update 70+ unittests that use random_seed, replaces program.random_seed=seed with paddle.manual_seed(seed) in several unittests.

NOTE, Currently there are 2 conditions of random number generation for users:
(1) op seed is not set, use default CPU Generator
(2) op seed is set, use a unique random engine for each and set the seed as op seed

@paddle-bot-old
Copy link

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

@paddle-bot-old
Copy link

paddle-bot-old bot commented Aug 20, 2020

✅ This PR's description meets the template requirements!
Please wait for other CI results.

@zhiqiu zhiqiu force-pushed the dev/refine_manual_seed branch 2 times, most recently from abdff7b to a297fd2 Compare August 23, 2020 15:24
yaoxuefeng6
yaoxuefeng6 previously approved these changes Aug 24, 2020
Copy link
Contributor

@yaoxuefeng6 yaoxuefeng6 left a comment

Choose a reason for hiding this comment

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

LGTM

jzhang533
jzhang533 previously approved these changes Aug 24, 2020
Copy link
Contributor

@jzhang533 jzhang533 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 dismissed stale reviews from jzhang533 and yaoxuefeng6 via a7d6b51 August 24, 2020 06:37
@zhiqiu zhiqiu force-pushed the dev/refine_manual_seed branch 2 times, most recently from 028b00f to 335a19b Compare August 26, 2020 18:40
@PaddlePaddle PaddlePaddle locked and limited conversation to collaborators Aug 27, 2020
@PaddlePaddle PaddlePaddle unlocked this conversation Aug 27, 2020
Copy link
Contributor

@yaoxuefeng6 yaoxuefeng6 left a comment

Choose a reason for hiding this comment

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

LGTM

self.generator.manual_seed(seed)
Parameters:
place(CPUPlace|CUDAPinnedPlace|CUDAPlace, optional): The place to allocate Tensor. Can be
CPUPlace, CUDAPinnedPlace, CUDAPlace. Default: None, means global place.
Copy link
Contributor

Choose a reason for hiding this comment

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

用户看到global place,会不知道啥意思的。

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Place参数的文档信息是和paddle.to_tensor()一致的,我后面再一起提个文档PR完善下这个描述。

Copy link
Contributor

@jzhang533 jzhang533 left a comment

Choose a reason for hiding this comment

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

lgtm

Copy link
Collaborator

@raindrops2sea raindrops2sea 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 changed the title refine manual seed Refine paddle.manual_seed Aug 28, 2020
@zhiqiu zhiqiu merged commit 844583c into PaddlePaddle:develop Aug 28, 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