tf.nn.conv2d(...)is the basic low-level convolution function provided by TensorFlow. tf.contrib.layers.conv2d(...)is part of building a higher-level API around the core of TensorFlow.
Note that in current versions of TensorFlow, parts of the layers are now also in the kernel. tf.layers.conv2d.
, tf.nn.conv2d - op, , . tf.layers.conv2d , . .
Tensorflow CNN, Tensorflow (). API :
def conv2d(x, W):
return tf.nn.conv2d(x, W, strides=[1, 1, 1, 1], padding='SAME')
W_conv1 = weight_variable([5, 5, 1, 32])
b_conv1 = bias_variable([32])
h_conv1 = tf.nn.relu(conv2d(x_image, W_conv1) + b_conv1)
TF Layers CNN (). TF :
conv1 = tf.layers.conv2d(
inputs=input_layer,
filters=32,
kernel_size=[5, 5],
padding="same",
activation=tf.nn.relu)
: , tf.layers.conv2d.