KEMBAR78
Fix SobolEngine default dtype handling by malfet · Pull Request #126781 · pytorch/pytorch · GitHub
Skip to content

Conversation

malfet
Copy link
Contributor

@malfet malfet commented May 21, 2024

  • Change default dtype argument to None and fetch it value via torch.get_default_dtype() call if not defined
  • Fix bug in first draw handling logic, that would ignore dtype in favor of default one due to type promotion
  • Add regression tests

Fixes #126478

@malfet malfet requested review from albanD and drisspg May 21, 2024 15:15
@pytorch-bot
Copy link

pytorch-bot bot commented May 21, 2024

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/126781

Note: Links to docs will display an error until the docs builds have been completed.

✅ You can merge normally! (1 Unrelated Failure)

As of commit d15dc6b with merge base 980f5ac (image):

FLAKY - The following job failed but was likely due to flakiness present on trunk:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

Copy link
Contributor

@drisspg drisspg left a comment

Choose a reason for hiding this comment

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

I think it looks good, it looks like from the tests that the default dtype is now float64?

@malfet
Copy link
Contributor Author

malfet commented May 21, 2024

I think it looks good, it looks like from the tests that the default dtype is now float64?

No, default dtype is still float32, notice context manager above the test that validates it (but probably can add it to the test itself, it it's not clear)

@malfet malfet added topic: bc breaking topic category suppress-bc-linter Suppresses the failures of API backward-compatibility linter (Lint/bc_linter) release notes: python_frontend python frontend release notes category labels May 21, 2024
Copy link
Collaborator

@albanD albanD left a comment

Choose a reason for hiding this comment

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

one doc update, SGTM otherwise

return result

def draw_base2(self, m: int, out: Optional[torch.Tensor] = None,
dtype: torch.dtype = torch.float32) -> torch.Tensor:
Copy link
Collaborator

Choose a reason for hiding this comment

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

docstring needs updating below

Copy link
Contributor Author

@malfet malfet May 21, 2024

Choose a reason for hiding this comment

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

I'm struggling a bit between Default: None and just deleting this line...

Copy link
Collaborator

Choose a reason for hiding this comment

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

deleting would be pretty badly bc-breaking no?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've meant delete Default: None line in the doc which does not add much clarify, as in the argument description its already said its optional

@malfet
Copy link
Contributor Author

malfet commented May 21, 2024

@pytorchbot merge

@pytorch-bot pytorch-bot bot added the ciflow/trunk Trigger trunk jobs on your pull request label May 21, 2024
@pytorchmergebot
Copy link
Collaborator

Merge started

Your change will be merged once all checks pass (ETA 0-4 Hours).

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

@github-actions github-actions bot deleted the malfet/fix-sobolengine-defaut-dtype branch June 22, 2024 05:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/trunk Trigger trunk jobs on your pull request Merged release notes: python_frontend python frontend release notes category suppress-bc-linter Suppresses the failures of API backward-compatibility linter (Lint/bc_linter) topic: bc breaking topic category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SobolEngine.draw does not respect the default dtype and always uses the passed in dtype (defaulted to float32)

5 participants