Tensorflow:张量的反向展平
Tensorflow: Reverse flattening of a tensor
OS: Kubuntu 14.04, Tensorflow 版本 = 0.12, Python 版本 = 2.7
在我的最后一层之后,我的神经网络的输出具有形状 [batch, height, width, 2]
,在我的例子中是 [64, 32, 256, 2]
。
之后我使用
output = tf.contrib.layers.flatten(input=output)
产生一个形状为[64, 16384]
的张量
出于评估目的,我想在不同的函数中反转这种扁平化以获得原始的 [64, 32, 256, 2]
张量。
怎么做?
只需reshape
到你想要的形状:tf.reshape(output, [-1, 32, 256, 2])
。
OS: Kubuntu 14.04, Tensorflow 版本 = 0.12, Python 版本 = 2.7
在我的最后一层之后,我的神经网络的输出具有形状 [batch, height, width, 2]
,在我的例子中是 [64, 32, 256, 2]
。
之后我使用
output = tf.contrib.layers.flatten(input=output)
产生一个形状为[64, 16384]
出于评估目的,我想在不同的函数中反转这种扁平化以获得原始的 [64, 32, 256, 2]
张量。
怎么做?
只需reshape
到你想要的形状:tf.reshape(output, [-1, 32, 256, 2])
。