def get_model_size(model):
    """
    Calculate model parameter size
    :param model:
    :return: total size of model, in bytes
    """
    weights = model.get_weights()
    model_size = 0
    for weight, _ in weights:
        model_size += weight.size * weight.itemsize
    return model_size
