From 60523e5f4d9b490870bd21d537e09def3b45ab28 Mon Sep 17 00:00:00 2001 From: iback Date: Mon, 18 Nov 2024 12:34:57 +0000 Subject: [PATCH] make ruff happy --- spineps/architectures/pl_unet.py | 2 +- spineps/architectures/unet3D.py | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/spineps/architectures/pl_unet.py b/spineps/architectures/pl_unet.py index 93839a1..b65389d 100755 --- a/spineps/architectures/pl_unet.py +++ b/spineps/architectures/pl_unet.py @@ -111,7 +111,7 @@ def _shared_step(self, target, gt, detach2cpu: bool = False): def _shared_metric_step(self, loss, _, gt, pred_cls): dice = mF.dice(pred_cls, gt, num_classes=self.n_classes) - diceFG = mF.dice(pred_cls, gt, num_classes=self.n_classes, ignore_index=0) # noqa: N806, N806 + diceFG = mF.dice(pred_cls, gt, num_classes=self.n_classes, ignore_index=0) # noqa: N806 dice_p_cls = mF.dice(pred_cls, gt, average=None, num_classes=self.n_classes) return {"loss": loss.detach().cpu(), "dice": dice, "diceFG": diceFG, "dice_p_cls": dice_p_cls} diff --git a/spineps/architectures/unet3D.py b/spineps/architectures/unet3D.py index f233925..e582d91 100755 --- a/spineps/architectures/unet3D.py +++ b/spineps/architectures/unet3D.py @@ -99,21 +99,21 @@ def forward(self, x, time=None, label=None, embedding=None) -> torch.Tensor: # t = None h = [] - ö = "-" + o = "-" for block1, block2, downsample in self.downs: # type: ignore x = block1(x, t) x = block2(x, t) h.append(x) x = downsample(x) if self.first_forward: - ö += "-" - print(ö, x.shape, "\t") + o += "-" + print(o, x.shape, "\t") x = self.mid_block1(x, t) x = self.mid_block2(x, t) if self.first_forward: - print(ö, x.shape) - ö = ö[:-1] + print(o, x.shape) + o = o[:-1] for block1, block2, upsample in self.ups: # type: ignore x = 0.5 * (x + h.pop()) @@ -121,8 +121,8 @@ def forward(self, x, time=None, label=None, embedding=None) -> torch.Tensor: # x = block2(x, t) x = upsample(x) if self.first_forward: - print(ö, x.shape, "\t") - ö = ö[:-1] + print(o, x.shape, "\t") + o = o[:-1] x = torch.cat((x, r), dim=1)