Skip to content

Commit

Permalink
replacing lambda assigned to variable with function
Browse files Browse the repository at this point in the history
  • Loading branch information
hmd101 committed Oct 16, 2024
1 parent a06e714 commit 9774f49
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tests/test_display.py
Original file line number Diff line number Diff line change
Expand Up @@ -732,9 +732,12 @@ def all_mad(self):
img = po.load_images(IMG_DIR / "256" / "nuts.pgm").to(DEVICE)
img = img[..., :16, :16]
model1 = po.metric.mse

# MAD requires metrics are *dis*-similarity metrics, so that they
# return 0 if two images are identical (SSIM normally returns 1)
model2 = lambda *args: 1 - po.metric.ssim(*args).mean()
def model2(*args):
return 1 - po.metric.ssim(*args).mean()

mad = po.synth.MADCompetition(img, model1, model2, "min")
mad.synthesize(max_iter=2)
mad2 = po.synth.MADCompetition(img, model1, model2, "max")
Expand Down

0 comments on commit 9774f49

Please sign in to comment.