Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/tensorflow/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Tensorflow 第二卷积层输入的维数?_Tensorflow - Fatal编程技术网

Tensorflow 第二卷积层输入的维数?

Tensorflow 第二卷积层输入的维数?,tensorflow,Tensorflow,在下面的代码中,我引入了一个卷积和一个最大池层。池层的输出形状为(4,6,6,1)。现在我想定义第二个卷积层。第二个卷积层的输入是什么?我可以调用相同的conv2d函数吗?但这里的输入通道不同 batch_size = 4 image_height = 12 image_width =12 input_channel = 2 output_channel =1 input = tf.Variable(tf.random_normal([batch_size,image_height

在下面的代码中,我引入了一个卷积和一个最大池层。池层的输出形状为(4,6,6,1)。现在我想定义第二个卷积层。第二个卷积层的输入是什么?我可以调用相同的conv2d函数吗?但这里的输入通道不同

 batch_size = 4
 image_height = 12
 image_width =12
 input_channel = 2
 output_channel =1
 input =  tf.Variable(tf.random_normal([batch_size,image_height,image_width,input_channel]))
 filter = tf.Variable(tf.random_normal([2,2,input_channel,output_channel]))
 def conv2d(inputs,filters):
     return tf.nn.conv2d(inputs,filters,strides=[1,1,1,1],padding='SAME')
 def max_pool(conv_out):
     return tf.nn.max_pool(conv_out,ksize=[1,2,2,1],strides=[1,2,2,1],padding='SAME')
 conv_out1 = conv2d(input,filter)
 pooling_out1= max_pool(conv_out1)
 sess =tf.InteractiveSession()
 sess.run(tf.initialize_all_variables())
 print conv_out1.get_shape()
 print pooling_out1.get_shape()

您可以调用相同的conv2d函数,但最好使用不同的过滤器