0

I have a tensor 'a' of shape [4,3,3]

a = [[[ 1  2  3]
  [ 4  5  6]
  [ 1  3  4]]

 [[ 7  8  9]
  [10 11 12]
  [ 6 56 76]]

 [[13 14 15]
  [16 17 18]
  [87 90 45]]

 [[19 20 21]
  [22 23 24]
  [23 33  1]]]

i want to reshape it to [3,4,3] but values should be as given bellow

final = [[[ 1  2  3]
          [ 7  8  9]
          [13 14 15]
          [19 20 21]]

         [[ 4  5  6]
          [10 11 12]
          [16 17 18]
          [22 23 24]]

         [[ 1  3  4]
          [ 6 56 76]
          [87 90 45]
          [23 33  1]]]

Seems tf.reshape([-1, 4,3]) will give me that shape but result is completely different to final. i was wondering is there any way i could achieve it?

John
  • 1,212
  • 1
  • 16
  • 30
  • 2
    This question has already been answered [here](https://stackoverflow.com/questions/38212205/swap-tensor-axes-in-tensorflow). – jkschin Jul 02 '17 at 07:10
  • Thanks @jkschin. I am able to get my desired result with `tf.transpose(a, [1, 0, 2])` – John Jul 03 '17 at 14:05

0 Answers0