Closed adamjstewart closed 11 months ago
Hi Adam,
einops.repeat typing logic is literally in this line: https://github.com/arogozhnikov/einops/blob/d0c7feef31eed7adceff07175300ebfc8bdee2b2/einops/einops.py#L459
and it wasn't changed for a long time. Also it is agnostic to framework, so I assume that's something with mypy.
Can confirm that this issue was fixed in PyTorch 2.2!
that's great, thanks for leaving this note
Describe the bug
This is a weird one. When I pass a PyTorch Tensor into einops.repeat, mypy 1.7+ with strict mode enabled tries to tell me that the return type is
typing.Never
.Reproduction steps
Create the following
test.py
file:Then run:
Expected behavior
I would expect the output to have the same type as the input, a PyTorch Tensor. This works fine for:
I haven't checked any other einops functions.
Your platform Version of einops, python and DL package that you used
I'm trying to figure out if this is a bug in einops, PyTorch, or mypy. Any help you can give me would be appreciated. I've noticed several PyTorch-specific issues with mypy 1.7+, so I doubt this is just an einops issue.