Skip to content

Add int type to device parameter of torch.set_default_device() on the docΒ #126646

Open
@hyperkai

Description

@hyperkai

πŸ“š The doc issue

The doc of torch.set_default_device() explains device parameter but it doesn't have int type as shown below:

device (device or string) – the device to set as default

Actually, device parameter with int type works as shown below:

import torch

torch.set_default_device(device=0) # Here

torch.tensor([0, 1, 2]).device
# device(type='cuda', index=0)

Suggest a potential alternative/fix

The doc should also say int type as shown below:

device (device, string or int) – the device to set as default

cc @svekars @brycebortree @albanD

Metadata

Metadata

Assignees

No one assigned

    Labels

    actionablemodule: docsRelated to our documentation, both in docs/ and docblocksmodule: python frontendFor issues relating to PyTorch's Python frontendtriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate module

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions