Skip to content Skip to sidebar Skip to footer

Tensorflow Python: Reshape Input [batchsize] To Tensor [batchsize, 2] With Specific Order

I have a tensor (shape=[batchsize]). I want to reshape the tensor in a specific order and into shape=[-1,2]. But I want to have: Element at [0,0] Element at [1,0] Element at [0,1]

Solution 1:

You could try

 tf.reshape(tf.matrix_transpose(tf.reshape(x, [-1, 2, 2])), [-1, 2])

Post a Comment for "Tensorflow Python: Reshape Input [batchsize] To Tensor [batchsize, 2] With Specific Order"