Skip to content

Instantly share code, notes, and snippets.

@MartinThoma
Created March 4, 2017 11:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MartinThoma/2a415dc354156d814412fd4a25af91f3 to your computer and use it in GitHub Desktop.
Save MartinThoma/2a415dc354156d814412fd4a25af91f3 to your computer and use it in GitHub Desktop.
total_parameters = 0
for variable in tf.trainable_variables():
# shape is an array of tf.Dimension
shape = variable.get_shape()
print(" shape: %s" % str(shape))
variable_parametes = 1
for dim in shape:
variable_parametes *= dim.value
print(" variable_parametes: %i" % variable_parametes)
total_parameters += variable_parametes
print(" ---")
print("total_parameters: %i" % total_parameters)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment