Back

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

model.count_params()

Or perform this directly:

import keras.backend as Kdef 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])

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!

31k questions

32.4k answers

500 comments

693 users