Back

Explore Courses Blog Tutorials Interview Questions
+1 vote
5 views
in AI and Deep Learning by (3.4k points)
Is there a simple way to find the number of parameters of a keras model if I have CNN, LSTm etc. Just like we do it in FFN.

1 Answer

0 votes
by (46k points)
edited by

To find number of parameters of a Keras model just use:

model.count_params()

Or perform this directly:

import keras.backend as K

def size(model): # Compute number of params in a model (the actual number of floats)
    return sum([np.prod(K.get_value(w).shape) for w in model.trainable_weights])

Interested in learning artificial intelligence? Check out this artificial intelligence tutorial!

Welcome to Intellipaat Community. Get your technical queries answered by top developers!

28.4k questions

29.7k answers

500 comments

94.1k users

Browse Categories

...