Tensorflow:经过一系列卷积和反卷积后得到相同的张量

Tensorflow:经过一系列卷积和反卷积后得到相同的张量,tensorflow,conv-neural-network,deconvolution,Tensorflow,Conv Neural Network,Deconvolution,我想知道,在通过卷积和反卷积滤波器传播张量之后,是否可能得到相同的张量。例如: random_image = np.random.rand(1, 6, 6, 3) input_image = tf.placeholder(shape=[1, 6, 6, 3], dtype=tf.float32) conv = tf.layers.conv2d(input_image, filters=6, kernel_size=[3, 3], strides=(1, 1), data_format="chan

我想知道,在通过卷积和反卷积滤波器传播张量之后,是否可能得到相同的张量。例如:

random_image = np.random.rand(1, 6, 6, 3)
input_image = tf.placeholder(shape=[1, 6, 6, 3], dtype=tf.float32)
conv = tf.layers.conv2d(input_image, filters=6, kernel_size=[3, 3], strides=(1, 1), data_format="channels_last")
deconv = tf.layers.conv2d_transpose(conv, filters=3, kernel_size=[3, 3], strides=(1, 1), data_format="channels_last")
sess = tf.Session()
sess.run(tf.global_variables_initializer())
print(random_image)
# Get an output which will be same as:
print(sess.run(deconv, feed_dict={input_image: random_image}))
换句话说,如果生成的
随机图像
向量是例如:
[1,2,3,4,5]
,则在卷积和反卷积之后,
反褶积
向量将是
[1,2,3,4,5]

然而,我无法让它工作


期待你的回答

例如,通过使用VarianceScaling初始化,可以获得某种程度的视觉相似性。甚至可以使用完全自定义的初始值设定项。但转置卷积并不是数学上的反卷积。因此,您无法使用
conv2d\u transpose
获得数学等式


看一看

定义“相同”。你想要的是完全相同的数组值还是某种视觉上的相似性?也许你在实际图像上测试它并分享结果?我的意思是随机图像向量是:
[1,2,3,4,5]
,经过卷积和反卷积后,输出是:
[1,2,3,4,5]
。我还根据你的评论更新了这个问题。可能会得到某种程度的视觉相似性,但数学相等,我想不会。看一看谢谢你的帮助!这就是我需要的澄清。请随意发布一个答案,这样我就可以接受它是正确的。