It could very well be that IDEs suppress errors, but checking a codebase that depends on pytorch with mypy does not work very well – e.g. the three simple lines above produce two errors.
I’m currently running mypy with --ignore-missing-imports --no-site-packages but I think that might suppress more than I’d like. I would like to opt out of pytorch type hints but apparently it’s not possible.