def _create_constant_uas_across_datapoints(self):
"""
Helper function. Creates and returns new theano variables representing noise, where noise is the same across
datapoints in the minibatch. Useful for binding the original noise variables in evaluation function where
randomness is required but same predictions are needed across minibatch.
"""
n_data = tt.iscalar('n_data')
net_uas = [tt.tile(self.srng.normal((n_units,), dtype=dtype), [n_data, 1]) for n_units in self.net.n_units[1:]]
uaa = tt.tile(self.srng.normal((self.n_components,), dtype=dtype), [n_data, 1])
uams = [tt.tile(self.srng.normal((self.n_outputs,), dtype=dtype), [n_data, 1]) for _ in xrange(self.n_components)]
uaUs = [tt.tile(self.srng.normal((self.n_outputs**2,), dtype=dtype), [n_data, 1]) for _ in xrange(self.n_components)]
# NOTE: order matters here
uas = net_uas + [uaa] + uams + uaUs
return n_data, uas
评论列表
文章目录