Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Signed-off-by: YunLiu <55491388+KumoLiu@users.noreply.github.com>
  • Loading branch information
KumoLiu committed Jul 22, 2024
1 parent d020fac commit 030500a
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 22 deletions.
2 changes: 1 addition & 1 deletion monai/apps/auto3dseg/hpo_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def update_params(self, *args, **kwargs):
raise NotImplementedError

@abstractmethod
def set_score(self):
def set_score(self, *args, **kwargs):
"""Report the evaluated results to HPO."""
raise NotImplementedError

Expand Down
4 changes: 2 additions & 2 deletions monai/data/meta_tensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ def peek_pending_rank(self):
a = self.pending_operations[-1].get(LazyAttr.AFFINE, None) if self.pending_operations else self.affine
return 1 if a is None else int(max(1, len(a) - 1))

def new_empty(self, size, dtype=None, device=None, requires_grad=False):
def new_empty(self, size, dtype=None, device=None, requires_grad=False): # type: ignore[override]
"""
must be defined for deepcopy to work
Expand Down Expand Up @@ -580,7 +580,7 @@ def ensure_torch_and_prune_meta(
img.affine = MetaTensor.get_default_affine()
return img

def __repr__(self):
def __repr__(self, *, Any = ...):
"""
Prints a representation of the tensor.
Prepends "meta" to ``torch.Tensor.__repr__``.
Expand Down
2 changes: 1 addition & 1 deletion monai/networks/layers/simplelayers.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ def get_binary_kernel(window_size: Sequence[int], dtype=torch.float, device=None

def median_filter(
in_tensor: torch.Tensor,
kernel_size: Sequence[int] = (3, 3, 3),
kernel_size: Sequence[int] | int = (3, 3, 3),
spatial_dims: int = 3,
kernel: torch.Tensor | None = None,
**kwargs,
Expand Down
12 changes: 6 additions & 6 deletions monai/networks/nets/quicknat.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class SkipConnectionWithIdx(SkipConnection):
Inherits from SkipConnection but provides the indizes with each forward pass.
"""

def forward(self, input, indices):
def forward(self, input, indices): # type: ignore[override]
return super().forward(input), indices


Expand All @@ -57,7 +57,7 @@ class SequentialWithIdx(nn.Sequential):
def __init__(self, *args):
super().__init__(*args)

def forward(self, input, indices):
def forward(self, input, indices): # type: ignore[override]
for module in self:
input, indices = module(input, indices)
return input, indices
Expand Down Expand Up @@ -165,7 +165,7 @@ def _get_layer(self, in_channels, out_channels, dilation):
)
return nn.Sequential(conv.get_submodule("adn"), conv.get_submodule("conv"))

def forward(self, input, _):
def forward(self, input, _): # type: ignore[override]
i = 0
result = input
result1 = input # this will not stay this value, needed here for pylint/mypy
Expand Down Expand Up @@ -215,7 +215,7 @@ def __init__(self, in_channels: int, max_pool, se_layer, dropout, kernel_size, n
super().__init__(in_channels, se_layer, dropout, kernel_size, num_filters)
self.max_pool = max_pool

def forward(self, input, indices=None):
def forward(self, input, indices=None): # type: ignore[override]
input, indices = self.max_pool(input)

out_block, _ = super().forward(input, None)
Expand Down Expand Up @@ -243,7 +243,7 @@ def __init__(self, in_channels: int, un_pool, se_layer, dropout, kernel_size, nu
super().__init__(in_channels, se_layer, dropout, kernel_size, num_filters)
self.un_pool = un_pool

def forward(self, input, indices):
def forward(self, input, indices): # type: ignore[override]
out_block, _ = super().forward(input, None)
out_block = self.un_pool(out_block, indices)
return out_block, None
Expand All @@ -270,7 +270,7 @@ def __init__(self, in_channels: int, se_layer, dropout, max_pool, un_pool, kerne
self.max_pool = max_pool
self.un_pool = un_pool

def forward(self, input, indices):
def forward(self, input, indices): # type: ignore[override]
out_block, indices = self.max_pool(input)
out_block, _ = super().forward(out_block, None)
out_block = self.un_pool(out_block, indices)
Expand Down
8 changes: 4 additions & 4 deletions monai/transforms/croppad/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -459,10 +459,10 @@ class SpatialCrop(Crop):

def __init__(
self,
roi_center: Sequence[int] | NdarrayOrTensor | None = None,
roi_size: Sequence[int] | NdarrayOrTensor | None = None,
roi_start: Sequence[int] | NdarrayOrTensor | None = None,
roi_end: Sequence[int] | NdarrayOrTensor | None = None,
roi_center: Sequence[int] | int | NdarrayOrTensor | None = None,
roi_size: Sequence[int] | int | NdarrayOrTensor | None = None,
roi_start: Sequence[int] | int | NdarrayOrTensor | None = None,
roi_end: Sequence[int] | int | NdarrayOrTensor | None = None,
roi_slices: Sequence[slice] | None = None,
lazy: bool = False,
) -> None:
Expand Down
8 changes: 4 additions & 4 deletions monai/transforms/croppad/dictionary.py
Original file line number Diff line number Diff line change
Expand Up @@ -438,10 +438,10 @@ class SpatialCropd(Cropd):
def __init__(
self,
keys: KeysCollection,
roi_center: Sequence[int] | None = None,
roi_size: Sequence[int] | None = None,
roi_start: Sequence[int] | None = None,
roi_end: Sequence[int] | None = None,
roi_center: Sequence[int] | int | None = None,
roi_size: Sequence[int] | int | None = None,
roi_start: Sequence[int] | int | None = None,
roi_end: Sequence[int] | int | None = None,
roi_slices: Sequence[slice] | None = None,
allow_missing_keys: bool = False,
lazy: bool = False,
Expand Down
2 changes: 1 addition & 1 deletion monai/visualize/class_activation_maps.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ def _upsample_and_post_process(self, acti_map, x):
acti_map = self.upsampler(img_spatial)(acti_map)
return self.postprocessing(acti_map)

def __call__(self):
def __call__(self, **kwargs):
raise NotImplementedError()


Expand Down
6 changes: 3 additions & 3 deletions tests/test_subpixel_upsample.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@
(2, 1, 32, 16, 8),
]

TEST_CASE_SUBPIXEL.append(TEST_CASE_SUBPIXEL_2D_EXTRA)
TEST_CASE_SUBPIXEL.append(TEST_CASE_SUBPIXEL_3D_EXTRA)
TEST_CASE_SUBPIXEL.append(TEST_CASE_SUBPIXEL_CONV_BLOCK_EXTRA)
TEST_CASE_SUBPIXEL.append(TEST_CASE_SUBPIXEL_2D_EXTRA) # type: ignore
TEST_CASE_SUBPIXEL.append(TEST_CASE_SUBPIXEL_3D_EXTRA) # type: ignore
TEST_CASE_SUBPIXEL.append(TEST_CASE_SUBPIXEL_CONV_BLOCK_EXTRA) # type: ignore

# add every test back with the pad/pool sequential component omitted
for tests in list(TEST_CASE_SUBPIXEL):
Expand Down

0 comments on commit 030500a

Please sign in to comment.