comparison pylearn/formulas/noise.py @ 1486:cb2e07d99f5a

switched inp==0 to T.eq(inp,0) in peppersalt noise
author Eric Thibodeau-Laufer <thiboeri@iro.umontreal.ca>
date Tue, 05 Jul 2011 14:31:10 -0400
parents 9a7dbcd0ebcf
children
comparison
equal deleted inserted replaced
1485:f7b348e6a98e 1486:cb2e07d99f5a
61 61
62 :note: The sum of the prob of salt and prob of pepper should be less then 1. 62 :note: The sum of the prob of salt and prob of pepper should be less then 1.
63 """ 63 """
64 assert inp.dtype in ['float32','float64'] 64 assert inp.dtype in ['float32','float64']
65 return theano_rng.binomial( size = inp.shape, n = 1, p = 1 - noise_lvl[0], dtype=inp.dtype) * inp \ 65 return theano_rng.binomial( size = inp.shape, n = 1, p = 1 - noise_lvl[0], dtype=inp.dtype) * inp \
66 + (inp==0) * theano_rng.binomial( size = inp.shape, n = 1, p = noise_lvl[1], dtype=inp.dtype) 66 + (theano.tensor.eq(inp,0)) * theano_rng.binomial( size = inp.shape, n = 1, p = noise_lvl[1], dtype=inp.dtype)
67 67
68 @tags.tags('noise','gauss','gaussian') 68 @tags.tags('noise','gauss','gaussian')
69 def gaussian_noise(theano_rng,inp,noise_lvl): 69 def gaussian_noise(theano_rng,inp,noise_lvl):
70 """ This add gaussian NLP noise to inp 70 """ This add gaussian NLP noise to inp
71 71