How to properly use mypy with PyTorch?

Hi there,
Could anyone please provide an example on how to setup mypy to properly work with PyTorch?
I’m currently using :

implicit_reexport = True

I am aware that typing with PyTorch is still a work in progress. So it would be very much appreciated if additional suggested flags could come with some explanation as to why we currently need them instead of pure strict.
If you also feel this could be useful in your project, please comment or like this post.


You can check our own mypy ini file here:
It is updated every time we add typing to new part of our code base.

1 Like