I implemented a standard Inception-V3 for custom image classification in both Keras/TF2 and PyTorch. Both give similar accuracy and loss value. I notice that the model file sizes are very different. In TF2 saved checkpoint files cp.ckpt-exx.data-00000-of-00001, the file size is 25M. After saving to a h5 file, it becomes 9M. However, in PyTorch, the model file is 85M. I calculate the number of parameters,
The TF/Keras model has number of parameters 21,780,646.
The PyTorch model has number of parameters 21,797,286.
If every parameter is 4 byte, then PyTorch file size is 21,797,286*4/1024**2 = 83.8 MB.
I am wondering how the Keras/TF makes the saved model file size as small as 9M? I look up everywhere online but cannot find an answer. Is the Keras/TF using variable length for the parameters?
Thanks a lot.