tf.nn.conv2d与tf.layers.conv2d的区别

1.  tf.nn.conv2d

tf.nn.conv2d(input, filter, strides, padding, use_cudnn_on_gpu=None, data_format=None, name=None)

 x,输入的图片全部信息,W即偏重

W = weight_variable([5,5,1,32]) #W=[h,w,channel,outchannel_size],输出空间的维度

#即W是filter为一个形状为[filter_height * filter_width * in_channels, output_channels]的二维矩阵

tf.nn.conv2d(x,W,strides=[1,1,1,1],padding='SAME')  


2.  tf.layers.conv2d

conv2d(inputs, filters, kernel_size, strides=(1, 1), padding='valid', data_format='channels_last',

dilation_rate=(1, 1), activation=None, use_bias=True, kernel_initializer=None,

bias_initializer=0x000002596A1FD898>,

kernel_regularizer=None, bias_regularizer=None, activity_regularizer=None,

kernel_constraint=None, bias_constraint=None, trainable=True, name=None, reuse=None)

示例:pool=[-1,14,14,16]

conv2 = tf.layers.conv2d(pool1, 32, 5, 1, 'same', activation=tf.nn.relu)    # -> (14, 14, 32)

你可能感兴趣的:(tesseract)