From 8b211cf4ffddf7ce78dbe8844259d1d57c38099d Mon Sep 17 00:00:00 2001 From: KumoLiu Date: Mon, 27 Nov 2023 22:43:39 +0800 Subject: [PATCH] fix #7261 Signed-off-by: KumoLiu --- monai/data/image_reader.py | 2 +- monai/inferers/inferer.py | 2 +- tests/test_video_datasets.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/monai/data/image_reader.py b/monai/data/image_reader.py index fe199d9570..0823d11834 100644 --- a/monai/data/image_reader.py +++ b/monai/data/image_reader.py @@ -1300,7 +1300,7 @@ def read(self, data: Sequence[PathLike] | PathLike, **kwargs) -> Sequence[Any] | kwargs_ = self.kwargs.copy() kwargs_.update(kwargs) for name in filenames: - nrrd_image = NrrdImage(*nrrd.read(name, index_order=self.index_order, *kwargs_)) + nrrd_image = NrrdImage(*nrrd.read(name, index_order=self.index_order, **kwargs_)) img_.append(nrrd_image) return img_ if len(filenames) > 1 else img_[0] diff --git a/monai/inferers/inferer.py b/monai/inferers/inferer.py index bf8c27e5c3..0b4199938d 100644 --- a/monai/inferers/inferer.py +++ b/monai/inferers/inferer.py @@ -584,10 +584,10 @@ def __call__( return super().__call__( inputs, network, + *args, device=inputs.device if gpu_stitching else torch.device("cpu"), buffer_steps=buffer_steps if buffered_stitching else None, buffer_dim=buffer_dim, - *args, **kwargs, ) except RuntimeError as e: diff --git a/tests/test_video_datasets.py b/tests/test_video_datasets.py index eedbe212eb..790feb51ee 100644 --- a/tests/test_video_datasets.py +++ b/tests/test_video_datasets.py @@ -39,7 +39,7 @@ def get_video_source(self): return self.video_source def get_ds(self, *args, **kwargs) -> VideoDataset: - return self.ds(video_source=self.get_video_source(), transform=TRANSFORMS, *args, **kwargs) # type: ignore + return self.ds(*args, video_source=self.get_video_source(), transform=TRANSFORMS, **kwargs) # type: ignore @unittest.skipIf(has_cv2, "Only tested when OpenCV not installed.") def test_no_opencv_raises(self):