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

Don't let pytorch __call__ implementation for modules circumvent our typing #218

Open
glencoe opened this issue Feb 22, 2023 · 2 comments
Open
Labels
enhancement New feature or request good first issue Good for newcomers medium priority

Comments

@glencoe
Copy link
Contributor

glencoe commented Feb 22, 2023

It would be great to have typing annotations on our forward functions be mirrored in the type annotations for call. E.g, LSTM actually returns tuple[Tensor, tuple[Tensor, Tensor]] and our forward function says so, but that information is overriden by pytorch's implementation of nn.Module.__call__. So either we should override that in our own modules and add the type annotation or we should find a way to programmatically propagate the type annotation from forward to __call__

@julianhoever
Copy link
Contributor

@glencoe I will have a look at it. Unfortunately, I have not yet started to integrate our own tensors into our modules. That's why I haven't encountered the problem yet. But that is the next step. Then I will try to get a fix for it.

@glencoe glencoe added enhancement New feature or request medium priority labels Feb 23, 2023
@glencoe
Copy link
Contributor Author

glencoe commented Feb 23, 2023

@julianhoever the issue arises from how pytorch treats their type annotations. It's not a bug ;) and not related to introducing our own tensor types. It's not urgent, i just added so we do not forget it.

@glencoe glencoe added the good first issue Good for newcomers label Feb 23, 2023
@julianhoever julianhoever removed their assignment Jun 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers medium priority
Projects
None yet
Development

No branches or pull requests

2 participants