From 4b7fcb24821f202663c5e5f7c4f6ec2933dc73cc Mon Sep 17 00:00:00 2001 From: HiroIshida Date: Sun, 23 Jul 2023 13:19:23 +0900 Subject: [PATCH] fix: suppress mypy error --- mohou/model/third_party/variational_lstm.py | 2 +- mohou/types.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mohou/model/third_party/variational_lstm.py b/mohou/model/third_party/variational_lstm.py index eb34e1f..3cfcfc0 100644 --- a/mohou/model/third_party/variational_lstm.py +++ b/mohou/model/third_party/variational_lstm.py @@ -131,7 +131,7 @@ def _setweights(self): mask = torch.autograd.Variable(torch.ones(raw_w.size(0), 1)) if raw_w.is_cuda: - mask = mask.cuda() + mask = mask.cuda() # type: ignore[assignment] mask = dropout(mask, p=self.dropout, training=True) # type: ignore w = mask.expand_as(raw_w) * raw_w setattr(self.module, name_w, w) diff --git a/mohou/types.py b/mohou/types.py index 6ec942c..d591916 100644 --- a/mohou/types.py +++ b/mohou/types.py @@ -325,7 +325,7 @@ def extract_contour_by_laplacian( blur_kernel_size = (int(rgb.shape[0] * 0.02), int(rgb.shape[1] * 0.02)) src_gray = cv2.cvtColor(rgb.numpy(), cv2.COLOR_BGR2GRAY) - dst = cv2.Laplacian(src_gray, cv2.CV_8U, ksize=laplace_kernel_size) + dst = cv2.Laplacian(src_gray, cv2.CV_8U, ksize=laplace_kernel_size) # type: ignore[attr-defined] dst2 = cv2.blur(dst, (blur_kernel_size[0], blur_kernel_size[1])) return GrayImage(np.expand_dims(np.uint8(dst2), axis=2))