def count_parameters(model):
    """Count TensorFlow model parameters.

    Parameters
    ----------
    model: TensorFlow model

    Returns
    -------
    total_parameters

    """
    total_parameters = 0
    # iterating over all variables
    for variable in model.trainable_variables:
        local_parameters=1
        shape = variable.get_shape() # getting shape of a variable
        for i in shape:
            local_parameters*=i  # mutiplying dimension values
        total_parameters+=local_parameters
    return int(total_parameters)