I’m seeing a similar problem. I have code that looks like:
import torch.nn as nn

class Foo(nn.Module):
    ...

but mypy errors out with:
error: Name "nn.Module" is not defined
error: Class cannot subclass "Module" (has type "Any")

No idea what this means or how to solve it.