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
If one prefers to avoid numpy (it can be left out for many projects), then:
all_trainable_vars = tf.reduce_sum([tf.reduce_prod(v.shape) for v in tf.trainable_variables()])
This is a TF translation of the previous answer by Julius Kunze.
As any TF operation, it requires a session run to evaluate:
print(sess.run(all_trainable_vars))