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

后端 未结 7 1184
清酒与你
清酒与你 2020-12-04 15:41

Is there a function call or another way to count the total number of parameters in a tensorflow model?

By parameters I mean: an N dim vector of trainable variables h

7条回答
  •  醉梦人生
    2020-12-04 15:58

    Update April 2020: tfprof and the Profiler UI have been deprecated in favor of profiler support in TensorBoard.

    The two existing answers are good if you're looking into computing the number of parameters yourself. If your question was more along the lines of "is there an easy way to profile my TensorFlow models?", I would highly recommend looking into tfprof. It profiles your model, including calculating the number of parameters.

提交回复
热议问题