tf.nn.conv2d vs tf.layers.conv2d

tf.nn.conv2d vs tf.layers.conv2d

Asked on December 17, 2018 in Tensorflow.
Add Comment


  • 1 Answer(s)

    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')
    
    Answered on December 17, 2018.
    Add Comment


  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.