Skip to content

Commit

Permalink
make ruff happy
Browse files Browse the repository at this point in the history
  • Loading branch information
Hendrik-code committed Nov 18, 2024
1 parent 57e492b commit 60523e5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion spineps/architectures/pl_unet.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}

Expand Down
14 changes: 7 additions & 7 deletions spineps/architectures/unet3D.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,30 +99,30 @@ 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())
x = block1(x, t)
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)

Expand Down

0 comments on commit 60523e5

Please sign in to comment.