本文主要是介绍tensorflow学习笔记-卷积,反卷积,空洞卷积,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
卷积
卷积函数为:
tf.nn.conv2d(input, filter, strides, padding, use_cudnn_on_gpu=None,data_format=None, name=None)
input为一个4-D的输入,fileter为滤波器(卷积核),4-D,通常为[height, width, input_dim, output_dim],height, width分别表示卷积核的高,宽.input_dim, output_dim分别表式输入维度,输出维度.
import tensorflow as tfx1 = tf.constant(1.0, shape=[1, 5, 5, 3])
x2 = tf.constant(1.0, shape=[1, 6, 6, 3])
kernel = tf.constant(1.0, shape=[3, 3, 3, 1])
y1 = tf.nn.conv2d(x1, kernel, strides=[1, 2, 2, 1], padding="SAME")
y2 = tf.nn.conv2d(x2, kernel, strides=[1, 2, 2, 1], padding="SAME")sess = tf.Session()
tf.global_variables_initializer().run(session=sess)
x1_cov, x2_cov = sess.run([y1, y2])print(x1_cov.shape)
print(x2_cov.shape)
这篇关于tensorflow学习笔记-卷积,反卷积,空洞卷积的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!