Skip to content

Commit

Permalink
batch noise now shuffles instead of rolls
Browse files Browse the repository at this point in the history
  • Loading branch information
jostosh committed Sep 10, 2018
1 parent 980fe9e commit a649c62
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions libspn/graph/spatialsum.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,10 +193,9 @@ def maybe_add_noise(val):
if batch_noise is not None and batch_noise != 0.0:
with tf.name_scope("BatchNoise"):
self.logger.debug1("{}: added batch noise {}".format(self, batch_noise))
rolled = tf.manip.roll(val, shift=1, axis=0)
shuffled = tf.stop_gradient(tf.random_shuffle(val))
val = tf.where(tf.less(
tf.random_uniform(tf.shape(val)), batch_noise),
tf.stop_gradient(rolled), val)
tf.random_uniform(tf.shape(val)), batch_noise), shuffled, val)
return val

dropconnect_keep_prob = utils.maybe_first(
Expand Down

0 comments on commit a649c62

Please sign in to comment.