tf.nn.conv2d vs tf.layers.conv2d
tf.nn.conv2d vs tf.layers.conv2d
The main difference is that filter(s).
- tf.layers.conv2d : It handles activation and bias automatically
- tf.nn.conv2d : This takes tensor as a filter, Hence you can specify the weight decay. like the following cifar10 code
kernel = _variable_with_weight_decay('weights', shape=[5, 5, 3, 64], stddev=5e-2, wd=0.0) conv = tf.nn.conv2d(images, kernel, [1, 1, 1, 1], padding='SAME')