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

"Either torch.float32 or torch.float64" should be removed from the doc of d parameter of torch.set_default_dtype() #126647

Open
hyperkai opened this issue May 19, 2024 · 2 comments
Labels
actionable easy label for easy docathon tasks module: docs Related to our documentation, both in docs/ and docblocks module: python frontend For issues relating to PyTorch's Python frontend triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module

Comments

@hyperkai
Copy link

hyperkai commented May 19, 2024

πŸ“š The doc issue

The doc explains d parameter but it only says Either torch.float32 or torch.float64 as shown below:

d (torch.dtype) – the floating point dtype to make the default. Either torch.float32 or torch.float64.

Actually, d parameter with torch.float16, torch.half, torch.bfloat16, torch.float or torch.double type also works as shown below:

import torch

torch.set_default_dtype(d=torch.float16)
torch.set_default_dtype(d=torch.half)
torch.get_default_dtype()
# torch.float16

torch.set_default_dtype(d=torch.bfloat16)
torch.get_default_dtype()
# torch.bfloat16

torch.set_default_dtype(d=torch.float32)
torch.set_default_dtype(d=torch.float)
torch.get_default_dtype()
# torch.float32

torch.set_default_dtype(d=torch.float64)
torch.set_default_dtype(d=torch.double)
torch.get_default_dtype()
# torch.float64

Suggest a potential alternative/fix

So, Either torch.float32 or torch.float64 should be removed from the doc should say int type as shown below:

d (torch.dtype) – the floating point dtype to make the default.

cc @svekars @brycebortree @albanD

@jbschlosser jbschlosser added module: docs Related to our documentation, both in docs/ and docblocks triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module module: python frontend For issues relating to PyTorch's Python frontend labels May 22, 2024
@jbschlosser
Copy link
Contributor

Sure, we'd accept a PR for tweaking the docs to match what's actually supported.

@jbschlosser jbschlosser added actionable easy label for easy docathon tasks labels May 22, 2024
@pranav-bot
Copy link

pranav-bot commented Jun 2, 2024

@hyperkai
The doc link leads to set_default_device instead of set_default_dtype

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
actionable easy label for easy docathon tasks module: docs Related to our documentation, both in docs/ and docblocks module: python frontend For issues relating to PyTorch's Python frontend triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module
Projects
None yet
Development

No branches or pull requests

3 participants