Skip to content

Commit

Permalink
Fix wrong type stubs
Browse files Browse the repository at this point in the history
  • Loading branch information
sublee committed May 31, 2019
1 parent a3e45cd commit d35d7ec
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
8 changes: 6 additions & 2 deletions stubs/torch/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -373,10 +373,14 @@ class Tensor:
def is_coalesced(self) -> bool: ...
def is_complex(self) -> bool: ...
def is_contiguous(self) -> bool: ...
def is_cuda(self) -> bool: ...
#MODIFIED BY TORCHGPIPE
is_cuda: bool
#END
def is_distributed(self) -> bool: ...
def is_floating_point(self) -> bool: ...
def is_leaf(self) -> bool: ...
#MODIFIED BY TORCHGPIPE
is_leaf: bool
#END
def is_nonzero(self) -> bool: ...
def is_same_size(self, other: Tensor) -> bool: ...
def is_set_to(self, tensor: Tensor) -> bool: ...
Expand Down
5 changes: 4 additions & 1 deletion stubs/torch/nn/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#MODIFIED BY TORCHGPIPE
from typing import Any, Callable, Iterable, Iterator, TypeVar
from typing import Any, Callable, Iterable, Iterator, Tuple, TypeVar

from torch import Tensor, device

Expand Down Expand Up @@ -33,6 +33,9 @@ class Module:
def register_forward_pre_hook(self, hook: __Hook1) -> __RemovableHandle: ...
def register_forward_hook(self, hook: __Hook2) -> __RemovableHandle: ...

def named_children(self) -> Iterable[Tuple[str, Module]]: ...
def add_module(self, name: str, module: Module) -> None: ...


class Sequential(Module):
def __init__(self, *args: Module) -> None: ...
Expand Down
3 changes: 3 additions & 0 deletions stubs/torch/nn/modules/batchnorm.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@ class _BatchNorm(Module):
affine: bool
track_running_stats: bool

weight: Tensor
bias: Tensor
running_mean: Tensor
running_var: Tensor
num_batches_tracked: Tensor

# for DeferredBatchNorm
sum: Tensor
Expand Down

0 comments on commit d35d7ec

Please sign in to comment.