def random_shift(self, images, states, actions):
print 'shifting the video sequence randomly in time'
tshift = 2
uselen = self.conf['use_len']
fulllength = self.conf['sequence_length']
nshifts = (fulllength - uselen) / 2 + 1
rand_ind = tf.random_uniform([1], 0, nshifts, dtype=tf.int64)
self.rand_ind = rand_ind
start = tf.concat(axis=0,values=[tf.zeros(1, dtype=tf.int64), rand_ind * tshift, tf.zeros(3, dtype=tf.int64)])
images_sel = tf.slice(images, start, [-1, uselen, -1, -1, -1])
start = tf.concat(axis=0, values=[tf.zeros(1, dtype=tf.int64), rand_ind * tshift, tf.zeros(1, dtype=tf.int64)])
actions_sel = tf.slice(actions, start, [-1, uselen, -1])
start = tf.concat(axis=0, values=[tf.zeros(1, dtype=tf.int64), rand_ind * tshift, tf.zeros(1, dtype=tf.int64)])
states_sel = tf.slice(states, start, [-1, uselen, -1])
return images_sel, states_sel, actions_sel
评论列表
文章目录