-
-
Notifications
You must be signed in to change notification settings - Fork 988
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
Type annotate pyro.poutine.runtime
#3288
Conversation
pyro/poutine/runtime
pyro.poutine.runtime
@@ -112,7 +112,7 @@ def get_posterior( | |||
""" | |||
raise NotImplementedError | |||
|
|||
def upstream_value(self, name: str) -> torch.Tensor: | |||
def upstream_value(self, name: str): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Temporarily removed the return type (changed to Any) so that mypy wouldn't complain. Will be fixed in a later PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, I'll try to keep review latency low...
# the global pyro stack | ||
_PYRO_STACK = [] | ||
_PYRO_STACK: List[Messenger] = [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great!
""" | ||
Allocate a dimension to an :class:`plate` with given name. | ||
Dim should be either None for automatic allocation or a negative | ||
integer for manual allocation. | ||
""" | ||
if name in self._stack: | ||
raise ValueError('duplicate plate "{}"'.format(name)) | ||
raise ValueError(f"duplicate plate '{name}'") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to change, but I've been using the notation f"duplicate plate {name!r}"
which I find easier to read.
ignore_errors = True | ||
warn_unused_ignores = True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add warn_unused_ignores
to the top level [mypy]
config? I've found that some # type: ignore
s mask real errors on the same line, so I've started using warn_unused_ignores
globally, but maybe this practice is too pedantic for a user base with diverse mypy versions.
No description provided.