def calc_num_parameters(layers):
    """
    Compute the total number of learnable parameters in the model

    Arguments:
    layers      -- list of (n_uints, activations) pairs that define network structure, including input layer X

    Returns:
    ret -- total number of learnable parameters
    """

    ret = 0
    for l in range(1, len(layers)):
        ret = ret + layers[l][0] * (layers[l - 1][0] + 2)

    return ret