将张量重塑为特定形状

时间:2017-07-02 05:19:33

标签: python-3.x tensorflow reshape

我有张量' a'形状[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]]]

我想将其重塑为[3,4,3],但值应如下所示

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]]]

似乎tf.reshape([ - 1,4,3])会给我那个形状,但结果与final完全不同。我想知道有什么方法可以实现吗?

0 个答案:

没有答案