How to find out keras model memory size?

Hello!

I am doing a school work and I need to find out keras model memory size so I could compare different models. It is supposed to be composed of weights/parameters and model itself. It was given that model.summary() should contain all the information. From there I see that layer info and output shapes with the number of parameters.

I understand parameters as they are just a numbers and so, number of parameters * 4B most likely will give how much room parameters take. But I know that more information is required to know memory occupied by this model.

Can anyone guide me on how I can find out how many bytes of memory this model occupies?

You can retrieve memory info with flops from the profiler as in:

You can also try:

1 Like

I am unable to figure out how the first link addresses my question. As for the second link, it tells me memory requirement, but not how much the model actually occupies memory. So I am still lost

The second link Is a good estimate of the on paper memory of your model.

The first one is the real memory in the runtime and e.g. you can retrieve It with ProfileOptionBuilder.time_and_memory() as tf.profiler option.

Other then the examples in the first link thread you can find more at: