数学表达式可以写成:
测试代码:
import tensorflow as tf
inp = tf.ones(shape=[1, 5, 5, 1])
# 更改 weight 的size 看看结果是什么样的。
weight = tf.ones(shape=[3, 6, 1, 1])
conv = tf.nn.conv2d(input=inp, filter=weight, strides=[1, 1, 1, 1], padding="SAME")
conv = tf.transpose(conv, perm=[0, 3, 1, 2])
with tf.Session() as sess:
print(sess.run(conv))