X-Git-Url: https://www.fleuret.org/cgi-bin/gitweb/gitweb.cgi?p=pytorch.git;a=blobdiff_plain;f=hallu.py;h=de251884c8c8bafac1e307030ccce1f61ee1935e;hp=7da66a632b23df8a614add6e3f7447a3b339b22a;hb=d74d7be5abef26c78d014bd179f2c52f81aca65b;hpb=a3c3a9430594b3109b314d02b81f91d9026c5f69 diff --git a/hallu.py b/hallu.py index 7da66a6..de25188 100755 --- a/hallu.py +++ b/hallu.py @@ -1,5 +1,10 @@ #!/usr/bin/env python +# Any copyright is dedicated to the Public Domain. +# https://creativecommons.org/publicdomain/zero/1.0/ + +# Written by Francois Fleuret + # ImageMagick's montage to make the mosaic # # montage hallu-*.png -tile 5x6 -geometry +1+1 result.png @@ -9,7 +14,7 @@ from torch.nn import functional as F class MultiScaleEdgeEnergy(torch.nn.Module): def __init__(self): - super(MultiScaleEdgeEnergy, self).__init__() + super().__init__() k = torch.exp(- torch.tensor([[-2., -1., 0., 1., 2.]])**2 / 2) k = (k.t() @ k).view(1, 1, 5, 5) self.gaussian_5x5 = torch.nn.Parameter(k / k.sum()).requires_grad_(False)