Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix typing behaviour of nn.Module for mypy #24

Open
omar-abdelgawad opened this issue Jan 19, 2024 · 0 comments
Open

Fix typing behaviour of nn.Module for mypy #24

omar-abdelgawad opened this issue Jan 19, 2024 · 0 comments
Labels
bug Something isn't working question Further information is requested

Comments

@omar-abdelgawad
Copy link
Owner

Describe the bug
Currently pytorch type annotates all of its nn.Module class as returning typing.Any which isn't helpful. When you try to define your forward method and type annotate it that doesn't reflect to call of the class as mentioned in this issue (https://discuss.pytorch.org/t/adding-typing-to-call-of-nn-module/118295). Please look into the problem for how to solve it and if there is no solution maybe use the solution in the above issue.

Expected behavior
using annotating forward as def forward(self, x: torch.Tensor) -> torch.Tensor: will make the call of out = model(x) return out as a torch.Tensor

@omar-abdelgawad omar-abdelgawad added the bug Something isn't working label Jan 19, 2024
@omar-abdelgawad omar-abdelgawad added the question Further information is requested label Jan 27, 2024
@omar-abdelgawad omar-abdelgawad removed this from the TUNIT Implementation milestone Jan 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant