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

Remove possible manual seeds from test files. #2436

Closed
wants to merge 8 commits into from

Conversation

skim0514
Copy link
Contributor

@skim0514 skim0514 commented Jun 2, 2022

For test files where applicable, removed manual seeds where applicable. Refactoring #2267

@skim0514 skim0514 marked this pull request as ready for review June 2, 2022 17:19
items_input = [[ele[i].clone() for ele in inputs] for i in range(n)]
items_result = torch.stack([functional(*items_input[i]) for i in range(n)])

# Batch the input and run
torch.random.manual_seed(seed)
Copy link
Collaborator

Choose a reason for hiding this comment

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

These two seeds cannot be removed. This helper function is supposed to run functions on the same seed twice and compare the results.

@@ -16,12 +16,10 @@ def assert_batch_consistency(self, transform, batch, *args, atol=1e-8, rtol=1e-5
n = batch.size(0)

# Compute items separately, then batch the result
torch.random.manual_seed(seed)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same here, the helper method must run the given function twice with the same seed. So these two seedings in this method have to stay.

Copy link
Collaborator

@mthrok mthrok left a comment

Choose a reason for hiding this comment

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

LG given tests pass.

@facebook-github-bot
Copy link
Contributor

@skim0514 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

Copy link
Contributor

@carolineechen carolineechen left a comment

Choose a reason for hiding this comment

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

looks good, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants