Skip to content

Commit

Permalink
[doc] expose torch.Tensor.xpu API to doc (pytorch#126383)
Browse files Browse the repository at this point in the history
# Motivation
The doc string related `torch.Tensor.xpu` has been added [here](https://github.com/pytorch/pytorch/blob/d61a81a9e76688ac8f338a6cfba932bf7779e5ce/torch/_tensor_docs.py#L1434) but not expose it to public doc, like [torch.Tensor.cuda](https://pytorch.org/docs/stable/generated/torch.Tensor.cuda.html#torch.Tensor.cuda). This PR intends to expose the document of `torch.Tensor.xpu` to public doc.

Pull Request resolved: pytorch#126383
Approved by: https://github.com/albanD
  • Loading branch information
guangyey authored and pytorchmergebot committed May 17, 2024
1 parent 776b878 commit d2f5a8a
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tools/pyi/gen_pyi.py
Original file line number Diff line number Diff line change
Expand Up @@ -1130,6 +1130,18 @@ def replace_special_case(hint: str) -> str:
)
)
],
"xpu": [
"def xpu({}) -> Tensor: ...".format(
", ".join(
[
"self",
"device: Optional[Union[_device, _int, str]] = None",
"non_blocking: _bool = False",
"memory_format: torch.memory_format = torch.preserve_format",
]
)
)
],
"cpu": [
"def cpu(self, memory_format: torch.memory_format = torch.preserve_format) -> Tensor: ..."
],
Expand Down

0 comments on commit d2f5a8a

Please sign in to comment.