def binarize(images):
"""
Stochastically binarize values in [0, 1] by treating them as p-values of
a Bernoulli distribution.
"""
return (
np.random.uniform(size=images.shape) < images
).astype(theano.config.floatX)
评论列表
文章目录