Fix NaN bug in iproc.white_noise
This commit is contained in:
parent
dcfb0d170d
commit
28cc864c0c
1 changed files with 4 additions and 1 deletions
|
@ -99,7 +99,10 @@ function iproc.white_noise(src, std, rgb_weights, gamma)
|
||||||
|
|
||||||
local dest
|
local dest
|
||||||
if gamma ~= 0 then
|
if gamma ~= 0 then
|
||||||
dest = src:clone():pow(gamma):add(noise):pow(1.0 / gamma)
|
dest = src:clone():pow(gamma):add(noise)
|
||||||
|
dest[torch.lt(dest, 0.0)] = 0.0
|
||||||
|
dest[torch.gt(dest, 1.0)] = 1.0
|
||||||
|
dest:pow(1.0 / gamma)
|
||||||
else
|
else
|
||||||
dest = src + noise
|
dest = src + noise
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue