-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Closed
Closed
Copy link
Labels
module: typingRelated to mypy type annotationsRelated to mypy type annotationstriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate moduleThis issue has been looked at a team member, and triaged and prioritized into an appropriate module
Description
🐛 Describe the bug
Repost of #118386 as a bug report template:
The generated type information in pytorch/torch/_C/__init__.pyi
fortensor.cpu
are wrong:
def cpu(self) -> Tensor:
r"""
cpu(memory_format=torch.preserve_format) -> Tensor
this is caused by
Lines 1204 to 1207 in 6da0e7f
simple_conversions = [ | |
"byte", | |
"char", | |
"cpu", |
where .cpu is added as having no parameters, which does not match the documentation or implementation
This bug causes mypy to complain about downstream usage of the memory_format parameter of Tensor.cpu.
Simiiar, .cuda is wrong here:
Lines 1102 to 1112 in 6da0e7f
"cuda": [ | |
"def cuda({}) -> Tensor: ...".format( | |
", ".join( | |
[ | |
"self", | |
"device: Optional[Union[_device, _int, str]] = None", | |
"non_blocking: _bool = False", | |
] | |
) | |
) | |
], |
where also memory_format is missing
Versions
main
Metadata
Metadata
Assignees
Labels
module: typingRelated to mypy type annotationsRelated to mypy type annotationstriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate moduleThis issue has been looked at a team member, and triaged and prioritized into an appropriate module