2017-08-28 64 views
0

假設我有一個形狀爲[3, 5, 200, 300, 3]的張量。我怎樣才能合併前兩個模糊,使得我的張量形狀爲[15, 200, 300, 3]。然後我可以逆轉合併操作並具有原始形狀。Tensorflow合併尺寸和反向合併

回答

1

你可以使用tf.reshape

a = tf.random_normal(shape=(3, 5, 200, 300, 3)) 
b = tf.reshape(a, shape=(15, 200, 300, 3)) 
... 
c = tf.reshape(b, shape=(3, 5, 200, 300, 3))