Skip to content Skip to sidebar Skip to footer

How To Roll Without Periodic Boundaries In Tensorflow?

I need a transformation of a tensor which is very similar to roll. The difference is that I do not want the values from the end of the axis to appear in the beginning. In other wor

Solution 1:

You could use

prev_xs = tf.concat((tf.zeros([tf.shape(xs)[0], 1]), xs[:, :1]), axis=1)

Step-by-step, we discard the last column of xs by indexing like [:, :1]. We create a column of zeros with the appropriate number of rows. Then we concatenate it in front of xs, pushing every column back by 1.

Post a Comment for "How To Roll Without Periodic Boundaries In Tensorflow?"