Skip to content

Commit

Permalink
Fix mypy and line-too-long errors (#3313)
Browse files Browse the repository at this point in the history
  • Loading branch information
fritzo committed Jan 21, 2024
1 parent c0b36f1 commit 1a11185
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions pyro/poutine/indep_messenger.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ def vectorized(self) -> bool:
return self.dim is not None

def _key(self) -> Tuple[str, Optional[int], int, int]:
size = self.size
with ignore_jit_warnings(["Converting a tensor to a Python number"]):
size = (
self.size.item() if isinstance(self.size, torch.Tensor) else self.size # type: ignore[attr-defined, unreachable]
)
return self.name, self.dim, size, self.counter
if isinstance(size, torch.Tensor): # type: ignore[unreachable]
size = size.item() # type: ignore[unreachable]
return self.name, self.dim, size, self.counter

def __eq__(self, other: object) -> bool:
if not isinstance(other, CondIndepStackFrame):
Expand Down
2 changes: 1 addition & 1 deletion pyro/poutine/runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ def _fn(
if not am_i_wrapped():
return fn(*args, **kwargs)
else:
msg = Message[_P, _T](
msg = Message(
type=type,
name=name,
fn=fn,
Expand Down

0 comments on commit 1a11185

Please sign in to comment.