1
weights = tf.placeholder("float",[5,5,1,1])
imagein = tf.placeholder("float",[1,32,32,1])
conv = tf.nn.conv2d(imagein,weights,strides=[1,1,1,1],padding="SAME")
deconv = tf.nn.conv2d_transpose(conv, weights, [1,32,32,1], [1,1,1,1],padding="SAME")
dw = np.random.rand(5,5,1,1)
noise = np.random.rand(1,32,32,1)
sess = tf.InteractiveSession()
convolved = conv.eval(feed_dict={imagein: noise, weights: dw})
deconvolved = deconv.eval(feed_dict={imagein: noise, weights: dw})
我一直想弄清conv2d_transpose爲了扭轉在Tensorflow中的卷積。我的理解是,「解卷積」應該包含與應用正常卷積然後其轉置之後的「噪聲」相同的數據,但「解卷積」只包含一些完全不同的圖像。我的代碼有什麼問題,或者理論不正確?爲什麼Conv2d_Transpose/deconv2d在tensorflow中返回原始輸入?