How to count total number of trainable parameters in a tensorflow model ?

How to count total number of trainable parameters in a tensorflow model ?

Asked on December 17, 2018 in Tensorflow.
Add Comment


  • 1 Answer(s)

    Here is an solution usingĀ numpy :

    np.sum([np.prod(v.get_shape().as_list()) for v in tf.trainable_variables()])
    
    Answered on December 17, 2018.
    Add Comment


  • Your Answer

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