Lets say, that we do want to process images (or ndim vectors) using Keras/TensorFlow. And we want, for fancy regularization, to shift each input by a random number of positions to the left (owerflown portions reappearing at the right side ).
How could it be viewed and solved:
1)
Is there any variation to numpy roll function for TensorFlow?
2)
x - 2D tensor
ri - random integer
concatenate(x[:,ri:],x[:,0:ri], axis=1) #executed for each single input to the layer, ri being random again and again (I can live with random only for each batch)
:
missing in the last line, should bey = tf.concat([x[:,x_len-i:], x[:,:x_len-i]], axis=1)
– Sirmons