Update diffusion.py
Browse files- diffusion.py +2 -2
diffusion.py
CHANGED
@@ -86,8 +86,8 @@ class Diffusion_cond:
|
|
86 |
print('The sampler {} is not implemented'.format(sampling_mode))
|
87 |
break
|
88 |
model.train() # it goes back to training mode
|
89 |
-
|
90 |
-
|
91 |
return x
|
92 |
|
93 |
mse = nn.MSELoss()
|
|
|
86 |
print('The sampler {} is not implemented'.format(sampling_mode))
|
87 |
break
|
88 |
model.train() # it goes back to training mode
|
89 |
+
x = (x.clamp(-1, 1) + 1) / 2 # to be in [-1, 1], the plus 1 and the division by 2 is to bring back values to [0, 1]
|
90 |
+
x = (x * 255).type(torch.uint8) # to bring in valid pixel range
|
91 |
return x
|
92 |
|
93 |
mse = nn.MSELoss()
|